Skip to content

Commit e2c6056

Browse files
authored
cmd: Fix sqlc init (#959)
1 parent 667b577 commit e2c6056

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
@@ -62,8 +62,11 @@ var initCmd = &cobra.Command{
6262
Short: "Create an empty sqlc.yaml settings file",
6363
RunE: func(cmd *cobra.Command, args []string) error {
6464
file := "sqlc.yaml"
65-
if f := cmd.Flag("file"); f != nil {
65+
if f := cmd.Flag("file"); f != nil && f.Changed {
6666
file = f.Value.String()
67+
if file == "" {
68+
return fmt.Errorf("file argument is empty")
69+
}
6770
}
6871
if _, err := os.Stat(file); !os.IsNotExist(err) {
6972
return nil

0 commit comments

Comments
 (0)