Merge pull request #448 from urfave/merging-joshuarubin-master

Merging joshuarubin master
This commit is contained in:
Dan Buch 2016-06-08 11:15:11 -04:00
commit fa949b48f3

12
flag.go
View File

@ -512,7 +512,7 @@ func (f Float64Flag) GetName() string {
func visibleFlags(fl []Flag) []Flag { func visibleFlags(fl []Flag) []Flag {
visible := []Flag{} visible := []Flag{}
for _, flag := range fl { for _, flag := range fl {
if !reflect.ValueOf(flag).FieldByName("Hidden").Bool() { if !flagValue(flag).FieldByName("Hidden").Bool() {
visible = append(visible, flag) visible = append(visible, flag)
} }
} }
@ -578,8 +578,16 @@ func withEnvHint(envVar, str string) string {
return str + envText return str + envText
} }
func stringifyFlag(f Flag) string { func flagValue(f Flag) reflect.Value {
fv := reflect.ValueOf(f) fv := reflect.ValueOf(f)
for fv.Kind() == reflect.Ptr {
fv = reflect.Indirect(fv)
}
return fv
}
func stringifyFlag(f Flag) string {
fv := flagValue(f)
switch f.(type) { switch f.(type) {
case IntSliceFlag: case IntSliceFlag: