-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting NoOptDefVal
forces using =
syntax
#134
Comments
I created a Pull request #135 Here's the output I get (and expected).
|
It's not possible to solve this issue unequivocally. Just consider if user will call three bool flags in the row like this: |
I do not fully understand the issue.
If 3 bool flags are passed, shouldn't pflag know that -a is a bool. if -abc is shorthand for a string flag, then that would override -abc as a multiple bool flags possibility. Am I missing something? |
Imagine What does -abc mean? Does it mean: |
Ah I understand what is meant by the above now.
I don't understand why this is an issue. Yes it is a case against the idea, but if pflag follows a set of rules it seems obvious to me that a="bc" would be the correct answer. Since -a is being passed the string value "bc" it would overwrite it default and use "bc". If I wanted the seperate functionality the correct solution would be to use:
Are there any other examples where this would actually be a problem? EDIT: Actually it appears that this is handled in NodeJS as parsed as @eparis second option:
I digress, Go isn't Node, but it seems every library handles it differently. |
Pflags accepts the following syntaxes for an integer argument:
Using this program:
I get the following results:
If I set
NoOptDefVal
, I get inconsistent behavior.Here are the results:
I expected
-v 3
and-v=3
to work the same way.Is this a bug, or am I missing the point of
NoOptDefVal
?The text was updated successfully, but these errors were encountered: