cli: add multipleStrings type
Will be used for --exclude.
This commit is contained in:
parent
06f1ea951b
commit
eaa5aecd42
12
cli_args.go
12
cli_args.go
|
@ -39,6 +39,18 @@ type argContainer struct {
|
||||||
_forceOwner *fuse.Owner
|
_forceOwner *fuse.Owner
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type multipleStrings []string
|
||||||
|
|
||||||
|
func (s *multipleStrings) String() string {
|
||||||
|
s2 := []string(*s)
|
||||||
|
return fmt.Sprint(s2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *multipleStrings) Set(val string) error {
|
||||||
|
*s = append(*s, val)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var flagSet *flag.FlagSet
|
var flagSet *flag.FlagSet
|
||||||
|
|
||||||
// prefixOArgs transform options passed via "-o foo,bar" into regular options
|
// prefixOArgs transform options passed via "-o foo,bar" into regular options
|
||||||
|
|
|
@ -77,3 +77,14 @@ func TestPrefixOArgs(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStringSlice(t *testing.T) {
|
||||||
|
var s multipleStrings
|
||||||
|
s.Set("foo")
|
||||||
|
s.Set("bar")
|
||||||
|
want := "[foo bar]"
|
||||||
|
have := s.String()
|
||||||
|
if want != have {
|
||||||
|
t.Errorf("Wrong string representation: want=%q have=%q", want, have)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue