Basically same as GNU getopt which has existed 25 years? Please use standard libraries for things like this.
Is "GNU getopt" painless? I suspect it depends on your definition of "pain", a pro/cons section would have clarified the rationnals for not using "getopt".
For sure it would be nice if people added a "prior art" comment whenever they reinvent the wheel.
I hope the people downvoting my original comment do know what getopt is and that nearly all command line tools on e.g. Linux use it.