Closed nafu closed 6 years ago
This is really important for fastlane's use of Commander :+1:
@nafu really great - thx for this PR
Thanks for the review, so glad to see a super fast response time here @ggilder 👍 Thanks for your help
@ggilder I addressed the feedback, and left the comment about mark for default_command. Thanks for your help.
@ggilder I also added another specs to make sure default_command behavior, could you review again? Thanks!
Hey @ggilder, let us know if there is anything else you need from our side. Once that change is merged, we'd love a new release for this, so we can start using it across all of @fastlane. No worries if it takes longer, just let us know so that we can use a fork in the mean-time 👍
Hi, sorry for the delay reviewing, been busy with the day job :)
I think the major snag for me is around the formatting. The asterisk feels kind of clunky, and I'm wondering if just adding another section would make more sense. Example:
NAME:
test
DESCRIPTION:
something
COMMANDS:
help Display global or [command] help documentation
install gem Install some gem
test test description
DEFAULT COMMAND:
install gem
GLOBAL OPTIONS:
....
Honestly it's hard because a "default command" is kind of a weird concept. Most of the oft-cited examples of "monolith" CLIs like git don't have them, so there's not much prior art as far as how a default command would be indicated in help text. Please direct me to examples if you know of any, I'm curious to see how this handled elsewhere!
Closing since this has not been updated in a while. Please feel free to reopen if this is still an issue for you.
Thanks, we're using a fork for fastlane, and everything's working great there 👍
Ok. You may want to rebase on top of the changes from 4.4.4 which I just released.
Thanks :+1:
@ggilder Thank you for maintaining great gem. 😄
Description
Add details information about default_command to help output. You can see sample outputs with rspec.
Commander::HelpFormatter::TerminalCompact
global help
https://github.com/nafu/commander/blob/06283baedce0db38d40e7dc28af8561751648ab6/spec/help_formatters/terminal_compact_spec.rb#L12 ``` test something Commands: help Display global or [command] help documentation install gem Install some gem test test description Global Options: -h, --help Display help documentation -v, --version Display version information -t, --trace Display backtrace when an error occurs ```global help with default_command
https://github.com/nafu/commander/blob/06283baedce0db38d40e7dc28af8561751648ab6/spec/help_formatters/terminal_compact_spec.rb#L42 ``` test something Commands: (* default) help Display global or [command] help documentation install gem * Install some gem test test description Global Options: -h, --help Display help documentation -v, --version Display version information -t, --trace Display backtrace when an error occurs Options for install gem: --testing-command Testing command --testing-command-second Testing command second ```global help with default_command that has not command option
https://github.com/nafu/commander/blob/06283baedce0db38d40e7dc28af8561751648ab6/spec/help_formatters/terminal_compact_spec.rb#L81 ``` test something Commands: (* default) help Display global or [command] help documentation install gem * Install some gem test test description Global Options: -h, --help Display help documentation -v, --version Display version information -t, --trace Display backtrace when an error occurs ```Commander::HelpFormatter::Terminal
global help
https://github.com/nafu/commander/blob/06283baedce0db38d40e7dc28af8561751648ab6/spec/help_formatters/terminal_spec.rb#L12 ``` NAME: test DESCRIPTION: something COMMANDS: help Display global or [command] help documentation install gem Install some gem test test description GLOBAL OPTIONS: -h, --help Display help documentation -v, --version Display version information -t, --trace Display backtrace when an error occurs ```global help with default_command that has command option
https://github.com/nafu/commander/blob/06283baedce0db38d40e7dc28af8561751648ab6/spec/help_formatters/terminal_spec.rb#L41 ``` NAME: test DESCRIPTION: something COMMANDS: (* default) help Display global or [command] help documentation install gem * Install some gem test test description GLOBAL OPTIONS: -h, --help Display help documentation -v, --version Display version information -t, --trace Display backtrace when an error occurs OPTIONS for install gem: --testing-command Testing command --testing-command-second Testing command second ```global help with default_command that has not command option
https://github.com/nafu/commander/blob/06283baedce0db38d40e7dc28af8561751648ab6/spec/help_formatters/terminal_spec.rb#L79 ``` NAME: test DESCRIPTION: something COMMANDS: (* default) help Display global or [command] help documentation install gem * Install some gem test test description GLOBAL OPTIONS: -h, --help Display help documentation -v, --version Display version information -t, --trace Display backtrace when an error occurs ```Motivation and Context
Even if you set default_command, the help command does not show the information about default_command. It is very helpful that you can see the default_command and its options with help command. 🚀
I updated not only erb files but rspec so that you can make sure this behavior.