diff --git a/src/command.ts b/src/command.ts index 51e9911b..1870ab92 100644 --- a/src/command.ts +++ b/src/command.ts @@ -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 [ diff --git a/test/command.test.ts b/test/command.test.ts index 4521dd97..69c51f62 100644 --- a/test/command.test.ts +++ b/test/command.test.ts @@ -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 = {