@toa.io/cli 1.0.0-alpha.22 → 1.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.23",
|
|
4
4
|
"description": "Toa CLI",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -22,16 +22,17 @@
|
|
|
22
22
|
"@toa.io/runtime": "*"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@toa.io/console": "1.0.0-alpha.
|
|
26
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
27
|
-
"@toa.io/kubernetes": "1.0.0-alpha.
|
|
28
|
-
"@toa.io/norm": "1.0.0-alpha.
|
|
29
|
-
"@toa.io/operations": "1.0.0-alpha.
|
|
30
|
-
"@toa.io/yaml": "1.0.0-alpha.
|
|
25
|
+
"@toa.io/console": "1.0.0-alpha.23",
|
|
26
|
+
"@toa.io/generic": "1.0.0-alpha.23",
|
|
27
|
+
"@toa.io/kubernetes": "1.0.0-alpha.23",
|
|
28
|
+
"@toa.io/norm": "1.0.0-alpha.23",
|
|
29
|
+
"@toa.io/operations": "1.0.0-alpha.23",
|
|
30
|
+
"@toa.io/yaml": "1.0.0-alpha.23",
|
|
31
31
|
"dotenv": "16.1.1",
|
|
32
32
|
"find-up": "5.0.0",
|
|
33
|
+
"jsonpath": "1.1.1",
|
|
33
34
|
"paseto": "3.1.4",
|
|
34
35
|
"yargs": "17.6.2"
|
|
35
36
|
},
|
|
36
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "234296f8367e6cc1b8db282e05acca6a432290be"
|
|
37
38
|
}
|
package/readme.md
CHANGED
|
@@ -66,7 +66,8 @@ Credentials specified in the output file are preserved.
|
|
|
66
66
|
<dt><code>toa export manifest</code></dt>
|
|
67
67
|
<dd>Print normalized manifest.
|
|
68
68
|
|
|
69
|
-
<code>--path</code> path to component (default <code>.</code>)<br/>
|
|
69
|
+
<code>--path</code> path to a component (default <code>.</code>)<br/>
|
|
70
|
+
<code>--jsonpath</code> JSONPath expression to filter the output<br/>
|
|
70
71
|
<code>--error</code> print errors only<br/>
|
|
71
72
|
<code>--output</code> output format (default <code>yaml</code>)
|
|
72
73
|
</dd>
|
|
@@ -17,6 +17,12 @@ const builder = (yargs) => {
|
|
|
17
17
|
desc: 'Path to a component',
|
|
18
18
|
default: '.'
|
|
19
19
|
})
|
|
20
|
+
.option('jsonpath', {
|
|
21
|
+
alias: 'j',
|
|
22
|
+
group: 'Command options:',
|
|
23
|
+
type: 'string',
|
|
24
|
+
desc: 'JSONPath expression'
|
|
25
|
+
})
|
|
20
26
|
.option('output', {
|
|
21
27
|
alias: 'o',
|
|
22
28
|
group: 'Command options:',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const jsonpath = require('jsonpath')
|
|
3
4
|
const { component } = require('@toa.io/norm')
|
|
4
5
|
const { console } = require('@toa.io/console')
|
|
5
6
|
const yaml = require('@toa.io/yaml')
|
|
@@ -11,7 +12,10 @@ const print = async (argv) => {
|
|
|
11
12
|
|
|
12
13
|
if (path === undefined) throw new Error(`No component found in ${argv.path}`)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
let manifest = await component(path)
|
|
16
|
+
|
|
17
|
+
if (argv.jsonpath !== undefined)
|
|
18
|
+
manifest = jsonpath.query(manifest, argv.jsonpath)
|
|
15
19
|
|
|
16
20
|
if (argv.error !== true) {
|
|
17
21
|
const result = argv.output === 'json'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { manifest } = require('../../handlers/export/entity')
|
|
4
|
-
|
|
5
|
-
const builder = (yargs) => {
|
|
6
|
-
yargs
|
|
7
|
-
.option('path', {
|
|
8
|
-
alias: 'p',
|
|
9
|
-
group: 'Command options:',
|
|
10
|
-
type: 'string',
|
|
11
|
-
desc: 'Path to a component',
|
|
12
|
-
default: '.'
|
|
13
|
-
})
|
|
14
|
-
.option('output', {
|
|
15
|
-
alias: 'o',
|
|
16
|
-
group: 'Command options:',
|
|
17
|
-
choices: ['yaml', 'json'],
|
|
18
|
-
desc: 'Output format',
|
|
19
|
-
default: 'yaml'
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.command = 'entity'
|
|
24
|
-
exports.desc = 'Print entity'
|
|
25
|
-
exports.builder = builder
|
|
26
|
-
exports.handler = manifest
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { component } = require('@toa.io/norm')
|
|
4
|
-
const { console } = require('@toa.io/console')
|
|
5
|
-
const yaml = require('@toa.io/yaml')
|
|
6
|
-
|
|
7
|
-
const { components: find } = require('../../util/find')
|
|
8
|
-
|
|
9
|
-
const print = async (argv) => {
|
|
10
|
-
const path = find(argv.path)
|
|
11
|
-
|
|
12
|
-
if (path === undefined) throw new Error(`No component found in ${argv.path}`)
|
|
13
|
-
|
|
14
|
-
const manifest = await component(path)
|
|
15
|
-
const entity = manifest.entity
|
|
16
|
-
|
|
17
|
-
if (entity === undefined)
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
const result = argv.output === 'json'
|
|
21
|
-
? JSON.stringify(entity, null, 2)
|
|
22
|
-
: yaml.dump(entity)
|
|
23
|
-
|
|
24
|
-
console.log(result)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.manifest = print
|