@@ -84,6 +84,7 @@ func TestOptionParsing(t *testing.T) {
84
84
cmds .StringOption ("flag" , "alias" , "multiple long" ),
85
85
cmds .BoolOption ("bool" , "b" , "a bool" ),
86
86
cmds .StringsOption ("strings" , "r" , "strings array" ),
87
+ cmds .DelimitedStringsOption ("," , "delimstrings" , "d" , "comma delimited string array" ),
87
88
},
88
89
Subcommands : map [string ]* cmds.Command {
89
90
"test" : & cmds.Command {},
@@ -154,6 +155,13 @@ func TestOptionParsing(t *testing.T) {
154
155
test ("-b --string foo test bar" , kvs {"bool" : true , "string" : "foo" }, words {"bar" })
155
156
test ("-b=false --string bar" , kvs {"bool" : false , "string" : "bar" }, words {})
156
157
test ("--strings a --strings b" , kvs {"strings" : []string {"a" , "b" }}, words {})
158
+
159
+ test ("--delimstrings a,b" , kvs {"delimstrings" : []string {"a" , "b" }}, words {})
160
+ test ("--delimstrings=a,b" , kvs {"delimstrings" : []string {"a" , "b" }}, words {})
161
+ test ("-d a,b" , kvs {"delimstrings" : []string {"a" , "b" }}, words {})
162
+ test ("-d=a,b" , kvs {"delimstrings" : []string {"a" , "b" }}, words {})
163
+ test ("-d=a,b -d c --delimstrings d" , kvs {"delimstrings" : []string {"a" , "b" , "c" , "d" }}, words {})
164
+
157
165
testFail ("foo test" )
158
166
test ("defaults" , kvs {"opt" : "def" }, words {})
159
167
test ("defaults -o foo" , kvs {"opt" : "foo" }, words {})
0 commit comments