Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
c6690cc1
Commit
c6690cc1
authored
Jan 26, 2021
by
Adin Schmahmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: DelimitedStringsOption now panics if an empty delimiter is passed in
parent
e2c3e22d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
option.go
option.go
+8
-2
No files found.
option.go
View file @
c6690cc1
...
...
@@ -199,7 +199,10 @@ func StringOption(names ...string) Option {
// StringsOption is a command option that can handle a slice of strings
func
StringsOption
(
names
...
string
)
Option
{
return
DelimitedStringsOption
(
""
,
names
...
)
return
&
stringsOption
{
Option
:
NewOption
(
Strings
,
names
...
),
delimiter
:
""
,
}
}
// DelimitedStringsOption like StringsOption is a command option that can handle a slice of strings.
...
...
@@ -207,8 +210,11 @@ func StringsOption(names ...string) Option {
// For example, instead of passing `command --option=val1 --option=val2` you can pass `command --option=val1,val2` or
// even `command --option=val1,val2 --option=val3,val4`.
//
// A delimiter of ""
means that no delimiter is use
d
// A delimiter of ""
is invali
d
func
DelimitedStringsOption
(
delimiter
string
,
names
...
string
)
Option
{
if
delimiter
==
""
{
panic
(
"cannot create a DelimitedStringsOption with no delimiter"
)
}
return
&
stringsOption
{
Option
:
NewOption
(
Strings
,
names
...
),
delimiter
:
delimiter
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment