Skip to content

Commit

Permalink
chore: better error message when value not supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
Piccirello committed Oct 23, 2021
1 parent e3ad9f6 commit 07d368f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,12 @@ doppler configure set key=123 otherkey=456`,

for _, arg := range args {
option := strings.Split(arg, "=")
if len(option) < 2 || (!configuration.IsValidConfigOption(option[0]) && !configuration.IsTranslatableConfigOption(option[0])) {
if !configuration.IsValidConfigOption(option[0]) && !configuration.IsTranslatableConfigOption(option[0]) {
return errors.New("invalid option " + option[0])
}
if len(option) < 2 {
return errors.New("option " + option[0] + " requires a value")
}
}

return nil
Expand Down

0 comments on commit 07d368f

Please sign in to comment.