Skip to content

Commit 5d535f8

Browse files
author
David Shiflet (from Dev Box)
committed
Fix 593
1 parent 69d6ae8 commit 5d535f8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cmd/sqlcmd/sqlcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func checkDefaultValue(args []string, i int) (val string) {
318318
'X': "0",
319319
'N': "true",
320320
}
321-
if isFlag(args[i]) && (len(args) == i+1 || args[i+1][0] == '-') {
321+
if isFlag(args[i]) && len(args[i]) == 2 && (len(args) == i+1 || args[i+1][0] == '-') {
322322
if v, ok := flags[rune(args[i][1])]; ok {
323323
val = v
324324
return

cmd/sqlcmd/sqlcmd_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,16 @@ func TestConvertOsArgs(t *testing.T) {
556556
[]string{"-ifoo.sql", "bar.sql", "-V10", "-X", "-va=b", "c=d"},
557557
[]string{"-ifoo.sql", "-i", "bar.sql", "-V10", "-X", "0", "-va=b", "-v", "c=d"},
558558
},
559+
{
560+
"X1 k2",
561+
[]string{"-X1", "-k2"},
562+
[]string{"-X1", "-k2"},
563+
},
564+
{
565+
"X k2",
566+
[]string{"-X", "-k2"},
567+
[]string{"-X", "0", "-k2"},
568+
},
559569
}
560570
for _, c := range tests {
561571
t.Run(c.name, func(t *testing.T) {

0 commit comments

Comments
 (0)