Skip to content

Commit 63c01b1

Browse files
Address code review feedback - remove extra blank lines and add test
- Remove unnecessary blank lines in convertOsArgs and preprocessHelpFlags - Add test case for -h followed by non-numeric value Co-authored-by: dlevy-msft-sql <[email protected]>
1 parent a5ee4e8 commit 63c01b1

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

cmd/sqlcmd/sqlcmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func Execute(version string) {
296296
func convertOsArgs(args []string) (cargs []string) {
297297
// Pre-process to handle special help flag cases
298298
args = preprocessHelpFlags(args)
299-
299+
300300
flag := ""
301301
first := true
302302
for i, a := range args {
@@ -342,7 +342,7 @@ func preprocessHelpFlags(args []string) []string {
342342
result = append(result, "--help")
343343
continue
344344
}
345-
345+
346346
// Handle "-h" without an argument: convert to "-?" to show help
347347
if arg == "-h" {
348348
// Check if next arg exists

cmd/sqlcmd/sqlcmd_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ func TestValidCommandLineToArgsConversion(t *testing.T) {
7878
{[]string{"-help"}, func(args SQLCmdArguments) bool {
7979
return args.Help
8080
}},
81+
{[]string{"-h", "abc"}, func(args SQLCmdArguments) bool {
82+
return args.Help
83+
}},
8184
{[]string{"-u", "-A"}, func(args SQLCmdArguments) bool {
8285
return args.UnicodeOutputFile && args.DedicatedAdminConnection
8386
}},

0 commit comments

Comments
 (0)