integrii / flaggy

Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.
The Unlicense
856 stars 30 forks source link

Fixes for unexpected flags not crashing out properly. Fixes #47 #55

Closed integrii closed 4 years ago

ravenpride commented 4 years ago

My application does not make use of subcommands, so I've tested it with an unkown global flag at the global level and it does not work. No error is reported.

integrii commented 4 years ago

I agree - this is totally broken still. Taking a look. I pulled those flags out because I went too quickly and didn't notice that those were in fact valid flags in that test.

integrii commented 4 years ago

Still working on new code to solve #47. This involves a new code path as described below:

integrii commented 4 years ago

Okay, all tests pass! Take a look. There is a lot of code here so if you don't get through all of it, no big deal. I am going to add some more tests before merging, I think - just to be sure.

ravenpride commented 4 years ago

I'm sorry to say that, but the unit tests on branch #47 are failing on my side.

integrii commented 4 years ago

D'oh! I'll take a look again and see if I missed something.

integrii commented 4 years ago

Okay, check it out now. I don't know what I was thinking before when I said tests pass. I must have somehow fooled myself.

I promise, tests pass now:

image

ravenpride commented 4 years ago

@integrii I can confirm that the tests pass now and that my own test input works as expected. Thank you very much for this awesome piece of work!