Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ES indices related commands to es:indices namespace #72

Merged
merged 2 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"vetur.format.defaultFormatter.ts": "prettier",
"vetur.format.defaultFormatter.js": "prettier-eslint",
"vetur.format.enable": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.tsdk": "node_modules/typescript/lib"
"editor.defaultFormatter": "vscode.typescript-language-features",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure these settings should live here?

"typescript.tsdk": "node_modules/typescript/lib",
"[feature]": {
"editor.defaultFormatter": "alexkrechik.cucumberautocomplete"
}
}
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ Then any argument will be passed as-is to the `sdk:query` method.
* [`kourou collection:import PATH`](#kourou-collectionimport-path)
* [`kourou config:diff FIRST SECOND`](#kourou-configdiff-first-second)
* [`kourou document:search INDEX COLLECTION [QUERY]`](#kourou-documentsearch-index-collection-query)
* [`kourou es:get INDEX ID`](#kourou-esget-index-id)
* [`kourou es:insert INDEX`](#kourou-esinsert-index)
* [`kourou es:list-index`](#kourou-eslist-index)
* [`kourou es:indices:get INDEX ID`](#kourou-esindicesget-index-id)
* [`kourou es:indices:insert INDEX`](#kourou-esindicesinsert-index)
* [`kourou es:indices:cat`](#kourou-esindicescat)
* [`kourou file:decrypt FILE`](#kourou-filedecrypt-file)
* [`kourou file:encrypt FILE`](#kourou-fileencrypt-file)
* [`kourou file:test FILE`](#kourou-filetest-file)
Expand Down Expand Up @@ -453,13 +453,13 @@ EXAMPLES

_See code: [src/commands/document/search.ts](src/commands/document/search.ts)_

## `kourou es:get INDEX ID`
## `kourou es:indices:get INDEX ID`

Gets a document from ES

```
USAGE
$ kourou es:get INDEX ID
$ kourou es:indices:get INDEX ID

ARGUMENTS
INDEX ES Index name
Expand All @@ -471,15 +471,15 @@ OPTIONS
--help show CLI help
```

_See code: [src/commands/es/get.ts](src/commands/es/get.ts)_
_See code: [src/commands/es/indices/get.ts](src/commands/es/indices/get.ts)_

## `kourou es:insert INDEX`
## `kourou es:indices:insert INDEX`

Inserts a document directly into ES (will replace if exists)

```
USAGE
$ kourou es:insert INDEX
$ kourou es:indices:insert INDEX

ARGUMENTS
INDEX ES Index name
Expand All @@ -492,15 +492,15 @@ OPTIONS
--id=id Document ID
```

_See code: [src/commands/es/insert.ts](src/commands/es/insert.ts)_
_See code: [src/commands/es/indices/insert.ts](src/commands/es/indices/insert.ts)_

## `kourou es:list-index`
## `kourou es:indices:cat`

Lists available ES indexes

```
USAGE
$ kourou es:list-index
$ kourou es:indices:cat

OPTIONS
-g, --grep=grep Match output with pattern
Expand All @@ -509,7 +509,7 @@ OPTIONS
--help show CLI help
```

_See code: [src/commands/es/list-index.ts](src/commands/es/list-index.ts)_
_See code: [src/commands/es/indices/cat.ts](src/commands/es/indices/cat.ts)_

## `kourou file:decrypt FILE`

Expand Down
18 changes: 15 additions & 3 deletions features/Elasticsearch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ Feature: Elasticsearch commands
And I create the following document:
| _id | "chuon-chuon-kim" |
| body | {} |
When I run the command "es:get" with args:
When I run the command "es:indices:get" with args:
| "&nyc-open-data.yellow-taxi" |
| "chuon-chuon-kim" |
Then I should match stdout with "chuon-chuon-kim"

@mappings
Scenario: List ES indexes
Scenario: Cat ES indexes
Given a collection "nyc-open-data":"green-taxi"
When I run the command "es:list-index" with flags:
When I run the command "es:indices:cat" with flags:
| --grep | "nyc-open-data" |
Then I should match stdout with "yellow-taxi"
And I should match stdout with "green-taxi"

@mappings
Scenario: Insert ES document
Given a collection "nyc-open-data":"green-taxi"
When I run the command "es:indices:insert" with:
| arg | &nyc-open-data.yellow-taxi | |
| flag | --id | kindred |
| flag | --body | {} |
When I run the command "es:indices:get" with args:
| "&nyc-open-data.yellow-taxi" |
| "kindred" |
Then I should match stdout with "kindred"
1 change: 1 addition & 0 deletions features/step_definitions/cli-steps.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs')

const _ = require('lodash')
const should = require('should')
const { Then } = require('cucumber')

// this need to build the lib with "npm run build" first
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"kuzzle-sdk": "^7.4.0",
"kuzzle-vault": "^2.0.0",
"listr": "^0.14.3",
"lodash": "^4.17.20",
"ndjson": "^1.5.0",
"node-emoji": "^1.10.0",
"strip-json-comments": "^3.1.0",
Expand Down Expand Up @@ -125,4 +126,4 @@
"test:functional:cucumber": "./node_modules/.bin/cucumber-js"
},
"types": "lib/index.d.ts"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { flags } from '@oclif/command'
import { Client } from '@elastic/elasticsearch'

import { Kommand } from '../../common'
import { Kommand } from '../../../common'

export default class EsListIndex extends Kommand {
static initSdk = false
Expand Down
2 changes: 1 addition & 1 deletion src/commands/es/get.ts → src/commands/es/indices/get.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { flags } from '@oclif/command'
import { Client } from '@elastic/elasticsearch'

import { Kommand } from '../../common'
import { Kommand } from '../../../common'

export default class EsGet extends Kommand {
static initSdk = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { flags } from '@oclif/command'
import { Client } from '@elastic/elasticsearch'

import { Kommand } from '../../common'
import { Kommand } from '../../../common'

export default class EsInsert extends Kommand {
static initSdk = false
Expand Down