Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Commit a9764ac

Browse files
refactor: update command flags for content-type commands to use long options and remove deprecated flags
1 parent 7447a2e commit a9764ac

8 files changed

Lines changed: 47 additions & 153 deletions

File tree

README.md

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,12 @@ Display recent changes to a Content Type
6767

6868
```
6969
USAGE
70-
$ csdx content-type:audit -c <value> [-s <value> | -a <value> | -a <value>] [-k <value> | | ]
70+
$ csdx content-type:audit --content-type <value> [-k <value> | -a <value>]
7171
7272
FLAGS
7373
-a, --alias=<value> Alias of the management token
74-
-a, --token-alias=<value> Management token alias
75-
-c, --content-type=<value> (required) Content Type UID
7674
-k, --stack-api-key=<value> Stack API Key
77-
-s, --stack=<value> Stack UID
75+
--content-type=<value> (required) Content Type UID
7876
7977
DESCRIPTION
8078
Display recent changes to a Content Type
@@ -85,24 +83,22 @@ EXAMPLES
8583
$ csdx content-type:audit --alias "management token" --content-type "home_page"
8684
```
8785

88-
_See code: [src/commands/content-type/audit.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/audit.ts)_
86+
_See code: [src/commands/content-type/audit.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/audit.ts)_
8987

9088
## `csdx content-type:compare`
9189

9290
Compare two Content Type versions
9391

9492
```
9593
USAGE
96-
$ csdx content-type:compare -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-l <value> -r <value>]
94+
$ csdx content-type:compare --content-type <value> [-k <value> | -a <value>] [--left <value> --right <value>]
9795
9896
FLAGS
9997
-a, --alias=<value> Alias of the management token
100-
-a, --token-alias=<value> Management token alias
101-
-c, --content-type=<value> (required) Content Type UID
10298
-k, --stack-api-key=<value> Stack API Key
103-
-l, --left=<value> Content Type version, i.e. prev version
104-
-r, --right=<value> Content Type version, i.e. later version
105-
-s, --stack=<value> Stack UID
99+
--content-type=<value> (required) Content Type UID
100+
--left=<value> Content Type version, i.e. prev version
101+
--right=<value> Content Type version, i.e. later version
106102
107103
DESCRIPTION
108104
Compare two Content Type versions
@@ -115,45 +111,43 @@ EXAMPLES
115111
$ csdx content-type:compare --alias "management token" --content-type "home_page" --left # --right #
116112
```
117113

118-
_See code: [src/commands/content-type/compare.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/compare.ts)_
114+
_See code: [src/commands/content-type/compare.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/compare.ts)_
119115

120116
## `csdx content-type:compare-remote`
121117

122118
compare two Content Types on different Stacks
123119

124120
```
125121
USAGE
126-
$ csdx content-type:compare-remote (-o <value> -r <value>) -c <value>
122+
$ csdx content-type:compare-remote (--origin-stack <value> --remote-stack <value>) --content-type <value>
127123
128124
FLAGS
129-
-c, --content-type=<value> (required) Content Type UID
130-
-o, --origin-stack=<value> (required) Origin Stack API Key
131-
-r, --remote-stack=<value> (required) Remote Stack API Key
125+
--content-type=<value> (required) Content Type UID
126+
--origin-stack=<value> (required) Origin Stack API Key
127+
--remote-stack=<value> (required) Remote Stack API Key
132128
133129
DESCRIPTION
134130
compare two Content Types on different Stacks
135131
136132
EXAMPLES
137-
$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page"
133+
$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
138134
```
139135

140-
_See code: [src/commands/content-type/compare-remote.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/compare-remote.ts)_
136+
_See code: [src/commands/content-type/compare-remote.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/compare-remote.ts)_
141137

142138
## `csdx content-type:details`
143139

144140
Display Content Type details
145141

146142
```
147143
USAGE
148-
$ csdx content-type:details -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-p]
144+
$ csdx content-type:details --content-type <value> [-k <value> | -a <value>] [--path]
149145
150146
FLAGS
151147
-a, --alias=<value> Alias of the management token
152-
-a, --token-alias=<value> Management token alias
153-
-c, --content-type=<value> (required) Content Type UID
154148
-k, --stack-api-key=<value> Stack API Key
155-
-p, --[no-]path show path column
156-
-s, --stack=<value> Stack UID
149+
--content-type=<value> (required) Content Type UID
150+
--[no-]path show path column
157151
158152
DESCRIPTION
159153
Display Content Type details
@@ -166,26 +160,23 @@ EXAMPLES
166160
$ csdx content-type:details --alias "management token" --content-type "home_page" --no-path
167161
```
168162

169-
_See code: [src/commands/content-type/details.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/details.ts)_
163+
_See code: [src/commands/content-type/details.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/details.ts)_
170164

171165
## `csdx content-type:diagram`
172166

173167
Create a visual diagram of a Stack's Content Types
174168

175169
```
176170
USAGE
177-
$ csdx content-type:diagram -o <value> -d portrait|landscape -t svg|dot [-s <value> | -a <value> | -a <value>] [-k
178-
<value> | | ]
171+
$ csdx content-type:diagram --output <value> --direction portrait|landscape --type svg|dot [-k <value> | -a <value>]
179172
180173
FLAGS
181174
-a, --alias=<value> Alias of the management token
182-
-a, --token-alias=<value> Management token alias
183-
-d, --direction=<option> (required) [default: portrait] graph orientation
184-
<options: portrait|landscape>
185175
-k, --stack-api-key=<value> Stack API Key
186-
-o, --output=<value> (required) full path to output
187-
-s, --stack=<value> Stack UID
188-
-t, --type=<option> (required) [default: svg] graph output file type
176+
--direction=<option> (required) [default: portrait] graph orientation
177+
<options: portrait|landscape>
178+
--output=<value> (required) full path to output
179+
--type=<option> (required) [default: svg] graph output file type
189180
<options: svg|dot>
190181
191182
DESCRIPTION
@@ -201,23 +192,21 @@ EXAMPLES
201192
$ csdx content-type:diagram --alias "management token" --output "content-model.dot" --type "dot"
202193
```
203194

204-
_See code: [src/commands/content-type/diagram.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/diagram.ts)_
195+
_See code: [src/commands/content-type/diagram.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/diagram.ts)_
205196

206197
## `csdx content-type:list`
207198

208199
List all Content Types in a Stack
209200

210201
```
211202
USAGE
212-
$ csdx content-type:list [-s <value> | -a <value> | -a <value>] [-k <value> | | ] [-o title|modified]
203+
$ csdx content-type:list [-k <value> | -a <value>] [--order title|modified]
213204
214205
FLAGS
215206
-a, --alias=<value> Alias of the management token
216-
-a, --token-alias=<value> Management token alias
217207
-k, --stack-api-key=<value> Stack API Key
218-
-o, --order=<option> [default: title] order by column
208+
--order=<option> [default: title] order by column
219209
<options: title|modified>
220-
-s, --stack=<value> Stack UID
221210
222211
DESCRIPTION
223212
List all Content Types in a Stack
@@ -230,5 +219,5 @@ EXAMPLES
230219
$ csdx content-type:list --alias "management token" --order modified
231220
```
232221

233-
_See code: [src/commands/content-type/list.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/list.ts)_
222+
_See code: [src/commands/content-type/list.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/list.ts)_
234223
<!-- commandsstop -->

src/commands/content-type/audit.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
flags,
44
managementSDKClient,
55
cliux,
6-
printFlagDeprecation,
76
} from "@contentstack/cli-utilities";
87
import buildOutput from "../../core/content-type/audit";
98
import { getStack, getUsers, getContentType } from "../../utils";
@@ -17,35 +16,21 @@ export default class AuditCommand extends Command {
1716
];
1817

1918
static flags: any = {
20-
stack: flags.string({
21-
char: "s",
22-
description: "Stack UID",
23-
exclusive: ["token-alias", "alias"],
24-
parse: printFlagDeprecation(["-s", "--stack"], ["-k", "--stack-api-key"]),
25-
}),
26-
2719
"stack-api-key": flags.string({
2820
char: "k",
2921
description: "Stack API Key",
30-
exclusive: ["token-alias", "alias"],
31-
}),
32-
33-
"token-alias": flags.string({
34-
char: "a",
35-
description: "Management token alias",
36-
parse: printFlagDeprecation(["--token-alias"], ["-a", "--alias"]),
22+
exclusive: ["alias"],
3723
}),
3824

3925
alias: flags.string({
4026
char: "a",
4127
description: "Alias of the management token",
28+
exclusive: ["stack-api-key"],
4229
}),
4330

4431
"content-type": flags.string({
45-
char: "c",
4632
description: "Content Type UID",
4733
required: true,
48-
parse: printFlagDeprecation(["-c"], ["--content-type"]),
4934
}),
5035
};
5136

src/commands/content-type/compare-remote.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import Command from "../../core/command";
22
import {
33
flags,
4-
FlagInput,
54
managementSDKClient,
65
cliux,
7-
printFlagDeprecation,
86
} from "@contentstack/cli-utilities";
97
import buildOutput from "../../core/content-type/compare";
108
import { getStack, getContentType } from "../../utils";
@@ -13,38 +11,32 @@ export default class CompareRemoteCommand extends Command {
1311
static description = "compare two Content Types on different Stacks";
1412

1513
static examples = [
16-
'$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page"',
14+
'$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"',
1715
];
1816

1917
static flags: any = {
2018
"origin-stack": flags.string({
21-
char: "o",
2219
description: "Origin Stack API Key",
2320
required: true,
2421
dependsOn: ["remote-stack"],
25-
parse: printFlagDeprecation(["-o"], ["--remote-stack"]),
2622
}),
2723

2824
"remote-stack": flags.string({
29-
char: "r",
3025
description: "Remote Stack API Key",
3126
required: true,
3227
dependsOn: ["origin-stack"],
33-
parse: printFlagDeprecation(["-r"], ["--remote-stack"]),
3428
}),
3529

3630
"content-type": flags.string({
37-
char: "c",
3831
description: "Content Type UID",
3932
required: true,
40-
parse: printFlagDeprecation(["-c"], ["--content-type"]),
4133
}),
4234
};
4335

4436
async run() {
4537
try {
4638
const { flags } = await this.parse(CompareRemoteCommand);
47-
await this.setup({ alias: undefined, stack: flags["origin-stack"] });
39+
await this.setup({ "stack-api-key": flags["origin-stack"] });
4840
this.contentTypeManagementClient = await managementSDKClient({
4941
host: this.cmaHost,
5042
"X-CS-CLI": this.context?.analyticsInfo,

src/commands/content-type/compare.ts

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Command from '../../core/command'
2-
import { flags, FlagInput, managementSDKClient, cliux, printFlagDeprecation } from '@contentstack/cli-utilities'
2+
import { flags, managementSDKClient, cliux } from '@contentstack/cli-utilities'
33
import buildOutput from '../../core/content-type/compare'
44
import { getStack, getContentType } from '../../utils'
55

@@ -13,49 +13,31 @@ export default class CompareCommand extends Command {
1313
]
1414

1515
static flags: any = {
16-
stack: flags.string({
17-
char: 's',
18-
description: 'Stack UID',
19-
exclusive: ['token-alias'],
20-
parse: printFlagDeprecation(['-s', '--stack'], ['-k', '--stack-api-key'])
21-
}),
22-
2316
'stack-api-key': flags.string({
2417
char: 'k',
2518
description: 'Stack API Key',
26-
exclusive: ['token-alias']
27-
}),
28-
29-
'token-alias': flags.string({
30-
char: 'a',
31-
description: 'Management token alias',
32-
parse: printFlagDeprecation(['--token-alias'], ['-a', '--alias'])
19+
exclusive: ['alias']
3320
}),
3421

3522
alias: flags.string({
3623
char: 'a',
37-
description: 'Alias of the management token'
24+
description: 'Alias of the management token',
25+
exclusive: ['stack-api-key']
3826
}),
3927

4028
'content-type': flags.string({
41-
char: 'c',
4229
description: 'Content Type UID',
43-
required: true,
44-
parse: printFlagDeprecation(['-c'], ['--content-type'])
30+
required: true
4531
}),
4632

4733
left: flags.integer({
48-
char: 'l',
4934
description: 'Content Type version, i.e. prev version',
50-
dependsOn: ['right'],
51-
parse: printFlagDeprecation(['-l'], ['--left'])
35+
dependsOn: ['right']
5236
}),
5337

5438
right: flags.integer({
55-
char: 'r',
5639
description: 'Content Type version, i.e. later version',
57-
dependsOn: ['left'],
58-
parse: printFlagDeprecation(['-r'], ['--right'])
40+
dependsOn: ['left']
5941
})
6042
}
6143

src/commands/content-type/details.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import Command from "../../core/command";
22
import {
33
flags,
4-
FlagInput,
54
managementSDKClient,
65
cliux,
7-
printFlagDeprecation,
86
} from "@contentstack/cli-utilities";
97
import buildOutput from "../../core/content-type/details";
108
import { getStack, getContentType } from "../../utils";
@@ -19,43 +17,27 @@ export default class DetailsCommand extends Command {
1917
];
2018

2119
static flags: any = {
22-
stack: flags.string({
23-
char: "s",
24-
description: "Stack UID",
25-
exclusive: ["token-alias"],
26-
parse: printFlagDeprecation(["-s", "--stack"], ["-k", "--stack-api-key"]),
27-
}),
28-
2920
"stack-api-key": flags.string({
3021
char: "k",
3122
description: "Stack API Key",
32-
exclusive: ["token-alias"],
33-
}),
34-
35-
"token-alias": flags.string({
36-
char: "a",
37-
description: "Management token alias",
38-
parse: printFlagDeprecation(["--token-alias"], ["-a", "--alias"]),
23+
exclusive: ["alias"],
3924
}),
4025

4126
alias: flags.string({
4227
char: "a",
4328
description: "Alias of the management token",
29+
exclusive: ["stack-api-key"],
4430
}),
4531

4632
"content-type": flags.string({
47-
char: "c",
4833
description: "Content Type UID",
4934
required: true,
50-
parse: printFlagDeprecation(["-c"], ["--content-type"]),
5135
}),
5236

5337
path: flags.boolean({
54-
char: "p",
5538
description: "show path column",
5639
default: true,
5740
allowNo: true,
58-
parse: printFlagDeprecation(["-p"], ["--path"]),
5941
}),
6042
};
6143

0 commit comments

Comments
 (0)