Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command options should also show up when using --help #26

Merged
merged 6 commits into from
Jun 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default class CommandHelp {
const name = a.name.toUpperCase()
let description = a.description || ''
if (a.default) description = `[default: ${a.default}] ${description}`
if (a.options) description = `(${a.options.join('|')}) ${description}`
return [name, description ? dim(description) : undefined]
}), {stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2})
return [
Expand Down
13 changes: 13 additions & 0 deletions test/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,19 @@ OPTIONS
--flag2=flag2 [default: .] flag2 desc
--flag3=flag3 flag3 desc`))

test
.commandHelp(class extends Command {
static id = 'apps:create'
static args = [
{name: 'arg1', description: 'Show the options', options: ['option1', 'option2']}
]
})
.it('outputs with possible options', ctx => expect(ctx.commandHelp).to.equal(`USAGE
$ oclif apps:create [ARG1]

ARGUMENTS
ARG1 (option1|option2) Show the options`))

// class AppsCreate3 extends Command {
// static id = 'apps:create'
// static flags = {
Expand Down