hroptatyr / yuck

Your Umbrella Command Kit, a bog-standard command line option parser for C with all the knickknackery and whatnots.
Other
61 stars 7 forks source link

Omit global options for subcommand #12

Closed jdemilledt closed 7 years ago

jdemilledt commented 7 years ago

Is there any way to omit global options for a subcommand?

hroptatyr commented 7 years ago

Emphasis on a subcommand? As in there should be global options and they should be used for all but one subcommand?

Also, -h|--help and -V|--version will always be there.

jdemilledt commented 7 years ago

Yes, that is correct

hroptatyr commented 7 years ago

Not really, but inside the subcommand switch you could check if any of the options were used. However, they will be shown in the help output because that's somewhat modular, first show global options then the subcommand sepcific options.

jdemilledt commented 7 years ago

Ok, that's fine. I see you have an option --no-auto-flags that excludes -h|--help and -V|--version. Could you make an option to exclude -V|--version only? I would implement that, but the source code is far more advanced than I've ever dealt with

hroptatyr commented 7 years ago

Sure, that's easy: commit 16cf0db has the --no-auto-flags split into --no-auto-help and --no-auto-version (and for backward compatibility the --no-auto-flags)

I hope saying the code is advanced doesn't secretly mean it's a mess? :)

jdemilledt commented 7 years ago

@hroptatyr It's too advanced for me to tell if it's spaghetti code or not. I honestly don't care if it's a mess. It works amazingly.