-
-
Notifications
You must be signed in to change notification settings - Fork 139
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 hook executed multiple times #377
Comments
What's the issue you're seeing exactly? |
|
I use var val string
type ValFlag string
var once sync.Once
func (f ValFlag) AfterApply() error {
once.Do(func() { val = string(f) })
fmt.Printf("val=%s; flag=%s\n", val, f)
return nil
} Output:
|
My real use case is setup global logger options. I don't use global options because a several subcommands not support logging. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I tried to share flag across commands, but flag hook executed for the each defined command.
Actual behavior:
Expected behavior:
The text was updated successfully, but these errors were encountered: