Closed kraptor closed 4 years ago
It is not possible and it has also annoyed me in a dispatchMulti
setting where that text gets repeated over and over.
It is a good feature idea, but maybe a little wobbly as stated. E.g., one might want it run-time switched, only not emitted when called recursively or something, right? So, ./multicmd foo -h
would still show it.
Even more fancy would be to maybe don't list -h/--help
if you're invoked via those flags.
One other wrinkle is that on a per-subcommand basis it is possible to alter the short option corresponding to --help
. So, if some command wanted to use ?
instead of -h
(with that -h
for --history
/--hash
/something) then you might still want to show that line. --help-syntax
and -help
never change, though.
In that case, maybe it's better to --help/--help-syntax
to be opt-in an/or disabled by a flag to dispatchXXXX, that is recursively kept for multicommands except added by hand?
Yeah. I will have to sit down with the code and try to figure out the cleanest interface. I'd look for a fix next week.
I'm not in a hurry, just pointing out something I find interesting before you reach 1.0 as I've seen you wanted to do (from Nim repo comments...)
Indeed I am getting close to stamping a 1.0..probably this month. This particular feature sounds like something easy to make backward compatible, though. I mean, some people are going to want that --help there all the time for tools like some analogue for multi-commands to the bash complete -F _longopt
or whatnot for TAB-completion. (They run the command with help/--help and parse the output. If you want --help-syntax or --help to be TAB-completable then they need to be in that machine-parsed output.)
Thanks for this! You are awesome, keep the good work.
You're welcome. I like it, too.
I thought about ditching the newline after the header and the list of subcommands in comprehensive help mode, but eh..That layout and a few other places should probably be extracted into CLI-author overridable files like cligen/syntaxHelp.nim
or even a proc that returns a layout string or something. That's all easy to make backward compatible since the existing state of affairs is inflexible. ;-)
This might be already documented/requested, but I didn't find anything how to do it. Is it possible to hide automatically injected flags like
--help
or--help-syntax
?I tried the following, but it doesn't work (obviously):