Skip to content

Commit 9096fae

Browse files
committed
refactor(cli): renaming to --id and adding verification
1 parent 738a9f6 commit 9096fae

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

templates/cli/index.js.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ program
3030
.option("--json", "Output in JSON format")
3131
.option("-f,--force", "Flag to confirm all warnings")
3232
.option("-a,--all", "Flag to push all resources")
33-
.option("--ids [id...]", "Flag to pass list of ids for a giving action")
33+
.option("--id [id...]", "Flag to pass list of ids for a giving action")
3434
.option("--report", "Enable reporting when cli is crashing")
3535
.on("option:json", () => {
3636
cliConfig.json = true;
@@ -48,8 +48,8 @@ program
4848
.on("option:all", () => {
4949
cliConfig.all = true;
5050
})
51-
.on("option:ids", function() {
52-
cliConfig.ids = this.opts().ids;
51+
.on("option:id", function() {
52+
cliConfig.ids = this.opts().id;
5353
})
5454
.showSuggestionAfterError()
5555
{% if sdk.test != "true" %}

templates/cli/lib/parser.js.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ const parseError = (err) => {
154154
}
155155

156156
const actionRunner = (fn) => {
157-
return (...args) => fn(...args).catch(parseError);
157+
return (...args) => {
158+
if (cliConfig.all && (Array.isArray(cliConfig.ids) && cliConfig.ids.length !== 0)) {
159+
error(`The '--all' and '--id' flags cannot be used together.`);
160+
process.exit(1);
161+
}
162+
return fn(...args).catch(parseError)
163+
};
158164
}
159165

160166
const parseInteger = (value) => {

0 commit comments

Comments
 (0)