File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -199,16 +199,22 @@ func StringOption(names ...string) Option {
199199
200200// StringsOption is a command option that can handle a slice of strings
201201func StringsOption (names ... string ) Option {
202- return DelimitedStringsOption ("" , names ... )
202+ return & stringsOption {
203+ Option : NewOption (Strings , names ... ),
204+ delimiter : "" ,
205+ }
203206}
204207
205208// DelimitedStringsOption like StringsOption is a command option that can handle a slice of strings.
206209// However, DelimitedStringsOption will automatically break up the associated CLI inputs based on the delimiter.
207210// For example, instead of passing `command --option=val1 --option=val2` you can pass `command --option=val1,val2` or
208211// even `command --option=val1,val2 --option=val3,val4`.
209212//
210- // A delimiter of "" means that no delimiter is used
213+ // A delimiter of "" is invalid
211214func DelimitedStringsOption (delimiter string , names ... string ) Option {
215+ if delimiter == "" {
216+ panic ("cannot create a DelimitedStringsOption with no delimiter" )
217+ }
212218 return & stringsOption {
213219 Option : NewOption (Strings , names ... ),
214220 delimiter : delimiter ,
You can’t perform that action at this time.
0 commit comments