Skip to content

Commit 996a73a

Browse files
authored
Fix panic when calling cmd.Do subsequently (#1614)
1 parent 708e763 commit 996a73a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/cmd/cmd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import (
1919
"github.com/kyleconroy/sqlc/internal/tracer"
2020
)
2121

22+
func init() {
23+
uploadCmd.Flags().BoolP("dry-run", "", false, "dump upload request (default: false)")
24+
}
25+
2226
// Do runs the command logic.
2327
func Do(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int {
2428
rootCmd := &cobra.Command{Use: "sqlc", SilenceUsage: true}
@@ -29,7 +33,6 @@ func Do(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int
2933
rootCmd.AddCommand(genCmd)
3034
rootCmd.AddCommand(initCmd)
3135
rootCmd.AddCommand(versionCmd)
32-
uploadCmd.Flags().BoolP("dry-run", "", false, "dump upload request (default: false)")
3336
rootCmd.AddCommand(uploadCmd)
3437

3538
rootCmd.SetArgs(args)

0 commit comments

Comments
 (0)