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-unixfs
Commits
117af86c
Commit
117af86c
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/cli: Error if there are duplicate values for an option
parent
b48b12e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
commands/cli/parse.go
commands/cli/parse.go
+5
-2
No files found.
commands/cli/parse.go
View file @
117af86c
package
cli
import
(
"fmt"
"strings"
"github.com/jbenet/go-ipfs/commands"
...
...
@@ -47,8 +48,6 @@ func parseOptions(input []string) (map[string]interface{}, []string, error) {
opts
:=
make
(
map
[
string
]
interface
{})
args
:=
make
([]
string
,
0
)
// TODO: error if one option is defined multiple times
for
i
:=
0
;
i
<
len
(
input
);
i
++
{
blob
:=
input
[
i
]
...
...
@@ -67,6 +66,10 @@ func parseOptions(input []string) (map[string]interface{}, []string, error) {
value
=
split
[
1
]
}
if
_
,
ok
:=
opts
[
name
];
ok
{
return
nil
,
nil
,
fmt
.
Errorf
(
"Duplicate values for option '%s'"
,
name
)
}
opts
[
name
]
=
value
}
else
{
...
...
This diff is collapsed.
Click to expand it.
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