aboutsummaryrefslogtreecommitdiff
path: root/string_slice.go
diff options
context:
space:
mode:
Diffstat (limited to 'string_slice.go')
-rw-r--r--string_slice.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/string_slice.go b/string_slice.go
index 0b7ddfe..b53648b 100644
--- a/string_slice.go
+++ b/string_slice.go
@@ -1,6 +1,7 @@
package pflag
import (
+ "encoding/csv"
"fmt"
"strings"
)
@@ -21,7 +22,12 @@ func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
}
func (s *stringSliceValue) Set(val string) error {
- v := strings.Split(val, ",")
+ stringReader := strings.NewReader(val)
+ csvReader := csv.NewReader(stringReader)
+ v, err := csvReader.Read()
+ if err != nil {
+ return err
+ }
if !s.changed {
*s.value = v
} else {