Skip to content

Commit

Permalink
Return optional ext arg for create command
Browse files Browse the repository at this point in the history
  • Loading branch information
chapsuk committed May 3, 2018
1 parent 2939c97 commit 6774054
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions commands/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ func Create(ctx *cli.Context, d driver.Interface) error {
return errors.New("NAME required")
}

// ext := ctx.Args().Get(1)
// switch ext {
// case "sql":
// case "go":
// default:
// ext = "sql"
// }
ext := ctx.Args().Get(1)
switch ext {
case "sql":
case "go":
default:
ext = "sql"
}

return d.Create(name, "sql")
return d.Create(name, ext)
}
4 changes: 2 additions & 2 deletions commands/migrate/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func Command() *cli.Command {
},
&cli.Command{
Name: "create",
Usage: "Creates new migration sql file",
ArgsUsage: "NAME",
Usage: "Creates new migration sql|go file",
ArgsUsage: "NAME EXT",
Action: func(ctx *cli.Context) error {
return commands.Create(ctx, migrator)
},
Expand Down
4 changes: 2 additions & 2 deletions commands/seed/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func Command() *cli.Command {
},
&cli.Command{
Name: "create",
Usage: "Creates new seed sql file with next version",
ArgsUsage: "NAME",
Usage: "Creates new seed sql|go file with next version",
ArgsUsage: "NAME EXT",
Action: func(ctx *cli.Context) error {
return commands.Create(ctx, seeder)
},
Expand Down

0 comments on commit 6774054

Please sign in to comment.