Skip to content

Commit

Permalink
Add -N strict option
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvdeshmukh committed Sep 4, 2023
1 parent 0a4cd19 commit 0b24eb9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/sqlcmd/sqlcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,10 @@ func normalizeFlags(cmd *cobra.Command) error {
case encryptConnection:
value := strings.ToLower(v)
switch value {
case "false", "true", "disable":
case "mandatory", "yes", "1", "t", "true", "disable", "optional", "no", "0", "f", "false", "strict":
return pflag.NormalizedName(name)
default:
err = invalidParameterError("-N", v, "false", "true", "disable")
err = invalidParameterError("-N", v, "mandatory", "yes", "1", "t", "true", "disable", "optional", "no", "0", "f", "false", "strict")
return pflag.NormalizedName("")
}
case format:
Expand Down
1 change: 1 addition & 0 deletions cmd/sqlcmd/sqlcmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func TestInvalidCommandLine(t *testing.T) {
{[]string{"-P"}, "'-P': Missing argument. Enter '-?' for help."},
{[]string{"-;"}, "';': Unknown Option. Enter '-?' for help."},
{[]string{"-t", "-2"}, "'-t -2': value must be greater than or equal to 0 and less than or equal to 65534."},
{[]string{"-N", "invalid"}, "'-N invalid': Unexpected argument. Argument value has to be one of [mandatory yes 1 t true disable optional no 0 f false strict]."},
}

for _, test := range commands {
Expand Down

0 comments on commit 0b24eb9

Please sign in to comment.