-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
Hi there,
func main() {
parser := argparse.NewParser("q-scheduler", "", nil)
startParser := parser.AddCommand("start", "Starts the scheduler", &argparse.ParserConfig{
DisableHelp: true,
})
initParser := parser.AddCommand("init", "", &argparse.ParserConfig{
DisableHelp: true,
})
configPath := parser.String("", "config-path", &argparse.Option{
Default: "/etc/q-scheduler/config.toml",
Help: "Path to the configuration file of q-scheduler.",
Inheritable: true,
})
if err := parser.Parse(nil); err != nil {
fmt.Println(err.Error())
return
}
}This panics:
omikron@xps13 ~/g/q-scheduler (main) [1]> go run cmd/q-scheduler/main.go start --config-path abc
panic: runtime error: slice bounds out of range [1:0]
goroutine 1 [running]:
github.com/hellflame/argparse.min({0xe57678?, 0x84210842?, 0xc0001738c0?})
/opt/go/pkg/mod/github.com/hellflame/argparse@v1.8.0/levenshtein.go:63 +0x7c
github.com/hellflame/argparse.decideMatch({0x7ffcaffd478c, 0xd}, {0x0, 0x0, 0xc0002da460?})
/opt/go/pkg/mod/github.com/hellflame/argparse@v1.8.0/levenshtein.go:8 +0x87
github.com/hellflame/argparse.(*Parser).Parse(0xc0002da380, {0xc000132020?, 0x7ffcaffd4786?, 0x5?})
/opt/go/pkg/mod/github.com/hellflame/argparse@v1.8.0/parse.go:502 +0x88d
github.com/hellflame/argparse.(*Parser).Parse(0xc0002da1c0, {0x0?, 0x0?, 0xa4849d?})
/opt/go/pkg/mod/github.com/hellflame/argparse@v1.8.0/parse.go:432 +0x19b
main.main()
/home/omikron/git/q-scheduler/cmd/q-scheduler/main.go:28 +0x145
exit status 2Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels