diff --git a/cmd/felis/migrate.go b/cmd/felis/migrate.go index 4bf752d..17b21a8 100644 --- a/cmd/felis/migrate.go +++ b/cmd/felis/migrate.go @@ -16,11 +16,15 @@ func cmdMigrate(args []string, stdout, stderr io.Writer) int { fs := flag.NewFlagSet("migrate", flag.ContinueOnError) fs.SetOutput(stderr) cfgPath := fs.String("config", "/etc/felis/felis.toml", "path to felis.toml") - if err := fs.Parse(args); err != nil { + // The "up" verb precedes any flags (felis migrate up -config path). Go's + // flag.Parse stops at the first non-flag token and would never see a flag + // placed after "up", silently falling back to the default -config. Pull the + // verb off the front, then parse the remaining flags. + if len(args) == 0 || args[0] != "up" { + fmt.Fprintln(stderr, "usage: felis migrate up [-config path]") return 2 } - if fs.Arg(0) != "up" { - fmt.Fprintln(stderr, "usage: felis migrate up [-config path]") + if err := fs.Parse(args[1:]); err != nil { return 2 }