Skip to content

Commit

Permalink
cmd: Fix sqlc init (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy authored Mar 30, 2021
1 parent 667b577 commit e2c6056
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ var initCmd = &cobra.Command{
Short: "Create an empty sqlc.yaml settings file",
RunE: func(cmd *cobra.Command, args []string) error {
file := "sqlc.yaml"
if f := cmd.Flag("file"); f != nil {
if f := cmd.Flag("file"); f != nil && f.Changed {
file = f.Value.String()
if file == "" {
return fmt.Errorf("file argument is empty")
}
}
if _, err := os.Stat(file); !os.IsNotExist(err) {
return nil
Expand Down

0 comments on commit e2c6056

Please sign in to comment.