upate string slice usage

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
main
Victor Vieux 9 years ago
parent bf4a526f48
commit 35ac968c9e

@ -124,7 +124,7 @@ type StringSliceFlag struct {
func (f StringSliceFlag) String() string {
firstName := strings.Trim(strings.Split(f.Name, ",")[0], " ")
pref := prefixFor(firstName)
return withEnvHint(f.EnvVar, fmt.Sprintf("%s [%v]\t%v", prefixedNames(f.Name), pref+firstName+" option "+pref+firstName+" option", f.Usage))
return withEnvHint(f.EnvVar, fmt.Sprintf("%s [%v]\t%v", prefixedNames(f.Name), pref+firstName+" ...", f.Usage))
}
func (f StringSliceFlag) Apply(set *flag.FlagSet) {

@ -75,22 +75,22 @@ var stringSliceFlagTests = []struct {
s := &cli.StringSlice{}
s.Set("")
return s
}(), "--help [--help option --help option]\t"},
}(), "--help [--help ...]\t"},
{"h", func() *cli.StringSlice {
s := &cli.StringSlice{}
s.Set("")
return s
}(), "-h [-h option -h option]\t"},
}(), "-h [-h ...]\t"},
{"h", func() *cli.StringSlice {
s := &cli.StringSlice{}
s.Set("")
return s
}(), "-h [-h option -h option]\t"},
}(), "-h [-h ...]\t"},
{"test", func() *cli.StringSlice {
s := &cli.StringSlice{}
s.Set("Something")
return s
}(), "--test [--test option --test option]\t"},
}(), "--test [--test ...]\t"},
}
func TestStringSliceFlagHelpOutput(t *testing.T) {

Loading…
Cancel
Save