commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
822 stars 74 forks source link

Inline --help instead of man page #58

Closed valleybay closed 6 years ago

valleybay commented 6 years ago

Would it be possible to have --help show inline, like with many other CLI-tools, instead of it opening a man page?

gmontard commented 6 years ago

👍

lebogan commented 6 years ago

Hello @valleybay,

Are you looking for a less verbose help screen? Which CLI-tools are you refering to? Something like?:

$ myapp --help
Usage:  myapp -flags args

And have the longer style available with:

$ myapp --help --verbose
Usage: blah bah blah
blah
blah

Or maybe for the less verbose style, something like?:

program :help_formatter, Commander::HelpFormatter::SuperTerminalCompact
gmontard commented 6 years ago

The thing that annoy me is the fact that the help open kind of a "new page" in the terminal, it's not displayed inline. Am I missing something?

ggilder commented 6 years ago

I believe you're talking about the behavior where the help text opens in your terminal's PAGER program (usually less) if it is too long to be displayed in the height of the current terminal. You can disable that behavior by setting the following flag in your program:

program :help_paging, false

I see that this option is not very clearly documented... if you want to submit a patch to the readme please do!