diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-08-30 22:29:57 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-09-08 20:18:43 +0300 |
commit | da9570f37b6c8ad71dc5636e33c31d49018c2821 (patch) | |
tree | db21860e362df4e9d210b599450c42c0c04e4355 /multi_string_flag.go | |
parent | cdb4ab073c7c4c3a9ef53df4c6f13e6642878395 (diff) |
Add multiflag support for new flag implementation
In the parent of this commit, I've added a new flag implementation to
support config using env vars or a config file. This commits add support
for multiflag value setting, when using a csv like structure for those
values.
This was needed as for those only the first value was being read.
Diffstat (limited to 'multi_string_flag.go')
-rw-r--r-- | multi_string_flag.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/multi_string_flag.go b/multi_string_flag.go index ba6d92ea..25e9b9fe 100644 --- a/multi_string_flag.go +++ b/multi_string_flag.go @@ -20,3 +20,12 @@ func (s *MultiStringFlag) Set(value string) error { *s = append(*s, value) return nil } + +// Split each flag +func (s *MultiStringFlag) Split() (result []string) { + for _, str := range *s { + result = append(result, strings.Split(str, ",")...) + } + + return +} |