From 67740542066dc6577377ee8706fd1fed38553c5a Mon Sep 17 00:00:00 2001 From: Maxim Krasilnikov Date: Thu, 3 May 2018 10:18:41 +0300 Subject: [PATCH] Return optional ext arg for create command --- commands/create.go | 16 ++++++++-------- commands/migrate/command.go | 4 ++-- commands/seed/command.go | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/commands/create.go b/commands/create.go index 78cf2f6..ebc8576 100644 --- a/commands/create.go +++ b/commands/create.go @@ -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) } diff --git a/commands/migrate/command.go b/commands/migrate/command.go index 922a669..6a7cd17 100644 --- a/commands/migrate/command.go +++ b/commands/migrate/command.go @@ -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) }, diff --git a/commands/seed/command.go b/commands/seed/command.go index 13f3c73..17aeaad 100644 --- a/commands/seed/command.go +++ b/commands/seed/command.go @@ -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) },