File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
src/commands/content-type Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ import Command from '../../core/command'
2+ import { flags } from '@contentstack/cli-command'
3+ import cli from 'cli-ux'
4+ import buildOutput from '../../core/content-type/list'
5+
6+ export default class DiagramCommand extends Command {
7+ static description = 'create a diagram of a Stack\'s Content Types' ;
8+
9+ static examples = [
10+ '$ csdx content-type:diagram -s "xxxxxxxxxxxxxxxxxxx"' ,
11+ '$ csdx content-type:diagram -a "management token"' ,
12+ ] ;
13+
14+ static flags = {
15+ stack : flags . string ( {
16+ char : 's' ,
17+ description : 'Stack UID' ,
18+ required : false ,
19+ exclusive : [ 'token-alias' ] ,
20+ multiple : false ,
21+ } ) ,
22+
23+ 'token-alias' : flags . string ( {
24+ char : 'a' ,
25+ description : 'management token alias' ,
26+ required : false ,
27+ } )
28+ }
29+
30+ async run ( ) {
31+ try {
32+ const { flags} = this . parse ( DiagramCommand )
33+ this . setup ( flags )
34+
35+ cli . action . start ( Command . RequestDataMessage )
36+
37+ const [ stack , contentTypes ] = await Promise . all ( [
38+ this . client . getStack ( this . apiKey ) ,
39+ this . client . getContentTypes ( this . apiKey , false ) ,
40+ ] )
41+
42+ cli . action . stop ( )
43+
44+ console . log ( contentTypes ) ;
45+
46+ } catch ( error ) {
47+ this . error ( error , { exit : 1 , suggestions : error . suggestions } )
48+ }
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments