pflag
pflag copied to clipboard
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
In some cases, I wish a flag has some particular values. It's similar to the enum. Normally we need a few interfaces functions below: * `func All() []string` * `func...
I've been trying to get the same behavior as `git` allows me when using something like ``` $ git commit -m "$(
I'm making my head around how to best implement the following scenario. I'm creating a cli using cobra with several (sub)commands: cli cmdA --flagA cli cmdB --flagA cli cmdC --flagB...
As of Go 1.16, base "flag" now has: ```go func (f *FlagSet) Func(name, usage string, fn func(string) error)` ``` Please add for feature parity -- `Func()` is probably the best...
Re: https://github.com/GoogleContainerTools/skaffold/issues/4129, https://github.com/spf13/cobra/issues/1047 In Skaffold we use cobra and pflags to define our CLI. We have the flags toggle values directly in an options object. We have two commands that...
There are use cases for testing or re-using flags from other programs where you actually want to copy flags from a flagset into a new one and not simply add...
1. Add func TryAddFlag{,Set}, which add flag{Set} and ignore conflicts. 2. Support EnvVars, and show env name in help message. 3. Support `AddFlag`. originally, AddFlag can accept a `pflag.Flag`, but...
In the standard `flag` package the `flag.boolValue` interface with its special `IsBoolFlag() bool` method is honored by the parser and allows creating `flag.Value` types that don't require an argument. In...
Adds a (*) sign to flags with the cobra required annotation. * fixes #250 Sample result: ``` --destination (*) string The path to the download dir. Defaults to some random...