@toa.io/cli 0.24.0-alpha.21 → 0.24.0-alpha.22

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": "0.24.0-alpha.21",
3
+ "version": "0.24.0-alpha.22",
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,16 @@
22
22
  "@toa.io/runtime": "*"
23
23
  },
24
24
  "dependencies": {
25
- "@toa.io/console": "0.24.0-alpha.21",
26
- "@toa.io/generic": "0.24.0-alpha.21",
27
- "@toa.io/kubernetes": "0.24.0-alpha.21",
28
- "@toa.io/norm": "0.24.0-alpha.21",
29
- "@toa.io/operations": "0.24.0-alpha.21",
30
- "@toa.io/yaml": "0.24.0-alpha.21",
25
+ "@toa.io/console": "0.24.0-alpha.22",
26
+ "@toa.io/generic": "0.24.0-alpha.22",
27
+ "@toa.io/kubernetes": "0.24.0-alpha.22",
28
+ "@toa.io/norm": "0.24.0-alpha.22",
29
+ "@toa.io/operations": "0.24.0-alpha.22",
30
+ "@toa.io/yaml": "0.24.0-alpha.22",
31
31
  "dotenv": "16.1.1",
32
32
  "find-up": "5.0.0",
33
33
  "paseto": "3.1.4",
34
34
  "yargs": "17.6.2"
35
35
  },
36
- "gitHead": "b30bbcf178be9339914e2e5203c61c0da2c3daf2"
36
+ "gitHead": "9680eca8da28019924a4c7cac5d803954d6c6936"
37
37
  }
package/readme.md CHANGED
@@ -90,8 +90,7 @@ $ toa replay --title "should add numbers"
90
90
  ```
91
91
 
92
92
  If the path is a Context root (containing `context.toa.yaml` file), samples for components within
93
- the Context will be
94
- found and replayed sequentially.
93
+ the Context will be found and replayed sequentially.
95
94
 
96
95
  ### export manifest
97
96
 
@@ -105,6 +104,10 @@ found and replayed sequentially.
105
104
  </dd>
106
105
  </dl>
107
106
 
107
+ ### export entity
108
+
109
+ Same as `exprot manifest` but outputs only the `entity`.
110
+
108
111
  ## Operations
109
112
 
110
113
  > Some commands use current `kubectl` and `docker` context.
@@ -0,0 +1,26 @@
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
@@ -14,7 +14,7 @@ const builder = (yargs) => {
14
14
  alias: 'p',
15
15
  group: 'Command options:',
16
16
  type: 'string',
17
- desc: 'Path to component',
17
+ desc: 'Path to a component',
18
18
  default: '.'
19
19
  })
20
20
  .option('output', {
@@ -0,0 +1,27 @@
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