Skip to content

Commit

Permalink
chore(cli): Declaratively require pipeline or app across ci:config co…
Browse files Browse the repository at this point in the history
…mmands (#2914)

* Declaratively require pipeline or app across ci:config commands

* Update test
  • Loading branch information
eablack authored Jul 5, 2024
1 parent c68c8c5 commit 26c5e0a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/commands/ci/config/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export default class CiConfigGet extends Command {

static flags = {
help: flags.help({char: 'h'}),
app: flags.app({required: false}),
app: flags.app(),
remote: flags.remote(),
pipeline: flags.pipeline({required: false}),
pipeline: flags.pipeline({exactlyOne: ['pipeline', 'app']}),
shell: flags.boolean({char: 's', description: 'output config var in shell format'}),
}

Expand Down
5 changes: 3 additions & 2 deletions packages/cli/src/commands/ci/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export default class CiConfig extends Command {
]

static flags = {
app: cmdFlags.string({char: 'a', description: 'app name'}),
app: cmdFlags.app(),
remote: cmdFlags.remote(),
shell: cmdFlags.boolean({char: 's', description: 'output config vars in shell format'}),
json: cmdFlags.boolean({description: 'output config vars in json format'}),
pipeline: cmdFlags.pipeline(),
pipeline: cmdFlags.pipeline({exactlyOne: ['pipeline', 'app']}),
}

async run() {
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/commands/ci/config/unset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ export default class CiConfigUnset extends Command {
static strict = false

static flags = {
help: flags.help({char: 'h'}),
app: flags.app({required: false}),
app: flags.app(),
remote: flags.remote(),
pipeline: flags.pipeline({required: false}),
pipeline: flags.pipeline({exactlyOne: ['pipeline', 'app']}),
}

async run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('ci:config', function () {
test
.command(['ci:config'])
.catch(error => {
expect(error.message).to.contain('Required flag: --pipeline PIPELINE or --app APP')
expect(error.message).to.contain('Exactly one of the following must be provided: --app, --pipeline')
})
.it('errors when not specifying a pipeline or an app')

Expand Down

0 comments on commit 26c5e0a

Please sign in to comment.