Hi,
I'm trying to use shflags to write a script with several different subcommands, such as (for example) git has: git pull, git push, git merge, etc. As such, I'd like the --help flag to print help for that specific subcommand instead of one monolithic help message for everything.
The way I'm attempting to achieve this is by overriding the flags_help function to do nothing unless a non-empty $1 is passed to it, and having each specific subcommand manually check for the help flag. However, the problem with this is it seems when the library detects the help flag, it executes flags_help and then exits.
An easy solution seems to me to make the exit part of the flags_help function, so that the behavior can be overriden for those who don't wish for usage of the help flag to result in an immediate exit of the flags parser.
Thanks!
Hi,
I'm trying to use shflags to write a script with several different subcommands, such as (for example) git has:
git pull,git push,git merge, etc. As such, I'd like the--helpflag to print help for that specific subcommand instead of one monolithic help message for everything.The way I'm attempting to achieve this is by overriding the
flags_helpfunction to do nothing unless a non-empty$1is passed to it, and having each specific subcommand manually check for the help flag. However, the problem with this is it seems when the library detects the help flag, it executesflags_helpand then exits.An easy solution seems to me to make the
exitpart of theflags_helpfunction, so that the behavior can be overriden for those who don't wish for usage of the help flag to result in an immediate exit of the flags parser.Thanks!