upate string slice usage

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Victor Vieux 2015-05-12 17:08:05 -07:00
parent bf4a526f48
commit 35ac968c9e
2 changed files with 5 additions and 5 deletions

View File

@ -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) {

View File

@ -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) {