mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Merge pull request #3747 from filbranden/keep_boolean_imported_flags
Keep boolean status of imported flags
This commit is contained in:
commit
e0acd75629
@ -65,6 +65,18 @@ func (v *flagValueWrapper) Type() string {
|
|||||||
return v.flagType
|
return v.flagType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type boolFlag interface {
|
||||||
|
flag.Value
|
||||||
|
IsBoolFlag() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *flagValueWrapper) IsBoolFlag() bool {
|
||||||
|
if bv, ok := v.inner.(boolFlag); ok {
|
||||||
|
return bv.IsBoolFlag()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Imports a 'flag.Flag' into a 'pflag.FlagSet'. The "short" option is unset
|
// Imports a 'flag.Flag' into a 'pflag.FlagSet'. The "short" option is unset
|
||||||
// and the type is inferred using reflection.
|
// and the type is inferred using reflection.
|
||||||
func AddFlagToPFlagSet(f *flag.Flag, fs *pflag.FlagSet) {
|
func AddFlagToPFlagSet(f *flag.Flag, fs *pflag.FlagSet) {
|
||||||
|
Loading…
Reference in New Issue
Block a user