| Age | Commit message (Collapse) | Author |
|
Implement SliceValue for better list semantics
|
|
|
|
|
|
|
|
fixes #157
|
|
|
|
|
|
|
|
|
|
Currently, if you don't set any value for a StringSliceVar, it will
end-up failing with an EOF error. It fails because the CSV parser for
the value can't read anything.
Special case when the string is empty to return an empty list.
|
|
There was no way to escape or use a , in a string slice so use the
encoding/csv library, rather than string.split() and let golang take
care of the encoding issues.
|
|
|
|
I added the ability to do: `-s=bob -s=john` and get `[]string{"bob", "john"}`
But if a default value was set to say `[]string{"eric"}` the above
operation was mistakenly resulting in: `[]string{"eric", "bob", "john"}
which was obviously not what was intended.
This is fixed by tracking if a value was parsed and overwriting the
default on the first time -s is found, but we append the 2+ time.
|
|
|
|
This allows users to do things like
```
cmd --filename=file1 --filename=file2 --filename=file3,file4
```
And internally we will get
```
[]string{"file1", "file2", "file3", "file4"}
```
|
|
This means things like autogenerated docs will show
`--filename=[]` instead of just `--filename=`
|
|
Arguments passed on the command line will be split on "," and will be
stored in a slice.
We can see this already exits in codegangsta/cli
https://github.com/codegangsta/cli/blob/44d40054fa6208a3013d7217aca72a2b8b0f5a0b/flag.go#L102
And people have written their own implementations for cobra/pflag
https://github.com/GoogleCloudPlatform/kubernetes/blob/c5ba95ee26cbec9694a780544b559a797956ea54/pkg/util/list.go
Lets just make it a first class flag
|