alexflint / go-arg

Struct-based argument parsing in Go
https://pkg.go.dev/github.com/alexflint/go-arg
BSD 2-Clause "Simplified" License
2.04k stars 100 forks source link

Arguments that start with '-' not parsed correctly #264

Open reflog opened 3 months ago

reflog commented 3 months ago

Hi! Here's a small issue I came across:

var args struct {
  Param string
}

./main --param A works ./main --param="-1h" works ./main --param "-1h" causes "error: missing value for -s"

Our CLI passes hour-differences this way and this used to work for us when using Go's flags, but unfortunately doesn't work with go-arg.

I understand that this is rather an edge case, but wanted to report it anyways.

Thanks for the great library!

davidjb commented 3 weeks ago

I'm experiencing this as well when trying to supply negative numbers as arguments and seeing the same error message.