Merge pull request #3747 from filbranden/keep_boolean_imported_flags

Keep boolean status of imported flags
This commit is contained in:
Joe Beda 2015-01-22 20:48:13 -08:00
commit e0acd75629

View File

@ -65,6 +65,18 @@ func (v *flagValueWrapper) Type() string {
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
// and the type is inferred using reflection.
func AddFlagToPFlagSet(f *flag.Flag, fs *pflag.FlagSet) {