upate string slice usage
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
parent
bf4a526f48
commit
35ac968c9e
2
flag.go
2
flag.go
@ -124,7 +124,7 @@ type StringSliceFlag struct {
|
|||||||
func (f StringSliceFlag) String() string {
|
func (f StringSliceFlag) String() string {
|
||||||
firstName := strings.Trim(strings.Split(f.Name, ",")[0], " ")
|
firstName := strings.Trim(strings.Split(f.Name, ",")[0], " ")
|
||||||
pref := prefixFor(firstName)
|
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) {
|
func (f StringSliceFlag) Apply(set *flag.FlagSet) {
|
||||||
|
@ -75,22 +75,22 @@ var stringSliceFlagTests = []struct {
|
|||||||
s := &cli.StringSlice{}
|
s := &cli.StringSlice{}
|
||||||
s.Set("")
|
s.Set("")
|
||||||
return s
|
return s
|
||||||
}(), "--help [--help option --help option]\t"},
|
}(), "--help [--help ...]\t"},
|
||||||
{"h", func() *cli.StringSlice {
|
{"h", func() *cli.StringSlice {
|
||||||
s := &cli.StringSlice{}
|
s := &cli.StringSlice{}
|
||||||
s.Set("")
|
s.Set("")
|
||||||
return s
|
return s
|
||||||
}(), "-h [-h option -h option]\t"},
|
}(), "-h [-h ...]\t"},
|
||||||
{"h", func() *cli.StringSlice {
|
{"h", func() *cli.StringSlice {
|
||||||
s := &cli.StringSlice{}
|
s := &cli.StringSlice{}
|
||||||
s.Set("")
|
s.Set("")
|
||||||
return s
|
return s
|
||||||
}(), "-h [-h option -h option]\t"},
|
}(), "-h [-h ...]\t"},
|
||||||
{"test", func() *cli.StringSlice {
|
{"test", func() *cli.StringSlice {
|
||||||
s := &cli.StringSlice{}
|
s := &cli.StringSlice{}
|
||||||
s.Set("Something")
|
s.Set("Something")
|
||||||
return s
|
return s
|
||||||
}(), "--test [--test option --test option]\t"},
|
}(), "--test [--test ...]\t"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStringSliceFlagHelpOutput(t *testing.T) {
|
func TestStringSliceFlagHelpOutput(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user