diff --git a/commands/cli/parse.go b/commands/cli/parse.go index 10c4bbfc3..8651aa658 100644 --- a/commands/cli/parse.go +++ b/commands/cli/parse.go @@ -1,6 +1,7 @@ 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 {