Closed fenollp closed 6 years ago
Note: this is saying that #36 was half solved, at least before the rewrite.
Ah!
args.Int("-v")
failed with key: "-v" failed type conversion
because it's already an int
!
Solved it by just using args["-v"].(int)
.
Maybe opts.go Int,Float64 funcs could have a case that checks reflect.TypeOf
before attempting strconv
? I can make that PR if you'd like.
Anyhow, this is more of feature request than a bugfix. Issue solved.
Hi. After the merge of the big rewrite about a week ago it seems that
[-vvv]
handling is broken. Before, something alongWith
args[“-v”].(int)
would take values from 0 to 3 for the inputs:mybin act
mybin -v act
mybin -vv act
mybin -vvv act
Now with the new parser and the new API
args.Int(“-v”)
gives a value of 0 and an error along the lines of “this is uncastable” for any amount of Vs.I will work on creating a minimal example that uses both APIs tomorrow. I don’t remember that I found this usage in the golang examples/tests.
But then I am maybe just misusing the newer api. What do you think? cc @aviddiviner