fix: default migration authoring directory to cwd
This commit is contained in:
1 parent
501629f225
commit
b49a6ae449
2 files changed
+31
-6
No files matched your search
@@ -21,16 +21,16 @@ func command() *urfavecli.Command {
|
||||
root := &urfavecli.Command{Name: "corestack-goose", Usage: "Author migrations before deployment"}
|
||||
for _, name := range []string{"create", "fix"} {
|
||||
root.Commands = append(root.Commands, &urfavecli.Command{Name: name,
|
||||
Flags: []urfavecli.Flag{&urfavecli.StringFlag{Name: "dir", Required: true}},
|
||||
Flags: []urfavecli.Flag{&urfavecli.StringFlag{Name: "dir", Value: ".", Usage: "Migration directory (defaults to the current working directory)"}},
|
||||
Action: func(_ context.Context, cmd *urfavecli.Command) error {
|
||||
if name == "create" {
|
||||
if cmd.NArg() != 2 {
|
||||
return fmt.Errorf("usage: create --dir <dir> <name> sql|go")
|
||||
return fmt.Errorf("usage: create [--dir <dir>] <name> sql|go")
|
||||
}
|
||||
return authoring.Create(cmd.String("dir"), cmd.Args().Get(0), cmd.Args().Get(1))
|
||||
}
|
||||
if cmd.NArg() != 0 {
|
||||
return fmt.Errorf("usage: fix --dir <dir>")
|
||||
return fmt.Errorf("usage: fix [--dir <dir>]")
|
||||
}
|
||||
return authoring.Fix(cmd.String("dir"))
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user