Skip to content

Commit 7a47de2

Browse files
fix: clarify empty-string-to-0 default scope in getOptionalIntArgument
Document that the empty-value path only applies to -r (errorsToStderr) bare flag usage; other callers always supply a value.
1 parent 89e24e9 commit 7a47de2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cmd/sqlcmd/sqlcmd.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ func getOptionalIntArgument(cmd *cobra.Command, name string) (i *int) {
376376
if val != nil && val.Changed {
377377
i = new(int)
378378
value := val.Value.String()
379-
// Handle empty value for flags that allow no argument (e.g., -r without value defaults to 0)
379+
// Bare flag with no argument (e.g., -r) defaults to 0.
380+
// This only applies to -r (errorsToStderr); other callers always provide a value.
380381
if value == "" {
381382
*i = 0
382383
return

0 commit comments

Comments
 (0)