-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
flag: add and support implicit boolFlag interface #4262
Labels
Milestone
Comments
I'm not sure it's valuable enough to bother. The flag package is intricate enough already and without careful guarding flag packages become overfertilized. However, if (I stress - if) one were to do this, a simpler, API-changeless way to do it would be to change the if statement to see if the flag is some kind of boolean, as opposed to explicitly boolValue. Then the client could use the existing interfaces to provide the desired behavior. reflect.ValueOf(flag.Value).Elem().Kind() == reflect.Bool Status changed to Thinking. |
1. Add interface from comment #3 as boolFlag (unexported). 2. Add IsBoolFlag method to boolVar implementation. 3. Document in flag.Value comment: // // If a Value has an IsBoolFlag() bool method returning true, // the command-line parser makes -name equivalent to -name=true // rather than using the next command-line argument. Labels changed: added priority-later, removed priority-triage. Status changed to Accepted. |
Fixed by https://golang.org/cl/6944064 |
This issue was closed by revision a6d986b. Status changed to Fixed. |
gopherbot
added
fixed
Suggested
Issues that may be good for new contributors looking for work to do.
labels
Dec 22, 2012
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
by brady:
The text was updated successfully, but these errors were encountered: