-
Notifications
You must be signed in to change notification settings - Fork 30
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
Changes from 2 commits
1ac1ef5
341363c
2f4c17a
c4a56ea
75cc22a
0f59492
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {Command} from '@oclif/command' | ||
|
||
// import Help from '..' | ||
|
||
export default class OptionsCommand extends Command { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would create a new command for all the CLIs which we definitely do not want. Inline the class like we do here: https://github.com/oclif/plugin-help/blob/master/test/command.test.ts#L116 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense to me now :D I updated the tests |
||
static description = 'display options' | ||
|
||
static args = [ | ||
{name: 'options', required: true, description: 'some options that should show', options: ['first', 'second']} | ||
] | ||
static strict = false | ||
|
||
async run() { | ||
// const {flags, argv} = this.parse(OptionsCommand) | ||
// let help = new Help(this.config, {all: flags.all}) | ||
// help.showHelp(argv) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {expect, test} from '@oclif/test' | ||
|
||
describe('help command', () => { | ||
test | ||
.stdout() | ||
.command(['options']) | ||
.skip() | ||
.it('shows help command help', ctx => { | ||
expect(ctx.stdout).to.equal(`display help for oclif | ||
|
||
USAGE | ||
$ oclif help [COMMAND] | ||
|
||
ARGUMENTS | ||
COMMAND some options that should show. Can be one of: first, second | ||
|
||
`) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you instead do:
This will better match how we show flag options.
Also, passing in a 3-length array to the list is likely not going to work in all cases. That behavior I plan to remove as we're not actually using it anyways I don't think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.