You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm probably missing something obvious, but how do I use pflag so that the only valid option is the short variant? That is, if I want just "-h" rather than something like "-h" and "--help"?
If I use:
flag.BoolVar(&help, "h", false, "Give help")
then Parse() requires --h
If I use:
flag.BoolVarP(&help, "", "h", false, "Give help")
then Parse() requires "-h" and the odd "--" whereas I was hoping an empty long-opt would have deactivated that variant.
I'm pretty sure that Posix/GNU do not insist on both variants of an option, but I've been wrong before.
The text was updated successfully, but these errors were encountered:
I'm probably missing something obvious, but how do I use pflag so that the only valid option is the short variant? That is, if I want just "-h" rather than something like "-h" and "--help"?
If I use:
flag.BoolVar(&help, "h", false, "Give help")
then Parse() requires --h
If I use:
flag.BoolVarP(&help, "", "h", false, "Give help")
then Parse() requires "-h" and the odd "--" whereas I was hoping an empty long-opt would have deactivated that variant.
I'm pretty sure that Posix/GNU do not insist on both variants of an option, but I've been wrong before.
The text was updated successfully, but these errors were encountered: