Skip to content

Commit abdb3bf

Browse files
authored
Fix: Make colon optional for reset (#559)
1 parent 58bc354 commit abdb3bf

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/sqlcmd/commands.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func newCommands() Commands {
7777
name: "LISTVAR",
7878
},
7979
"RESET": {
80-
regex: regexp.MustCompile(`(?im)^[ \t]*:RESET(?:[ \t]+(.*$)|$)`),
80+
regex: regexp.MustCompile(`(?im)^[ \t]*?:?RESET(?:[ \t]+(.*$)|$)`),
8181
action: resetCommand,
8282
name: "RESET",
8383
},

pkg/sqlcmd/commands_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func TestCommandParsing(t *testing.T) {
5353
{` !! dir c:\`, "EXEC", []string{` dir c:\`}},
5454
{`!!dir c:\`, "EXEC", []string{`dir c:\`}},
5555
{`:XML ON `, "XML", []string{`ON `}},
56+
{`:RESET`, "RESET", []string{""}},
57+
{`RESET`, "RESET", []string{""}},
5658
}
5759

5860
for _, test := range commands {

0 commit comments

Comments
 (0)