Sometimes a good API isn't the right answer. I like getopt as it is but I wanted a little different control. So I wrote up an article on my work around. https://dev.to/jessekphillips/argument-parsing-into-structure-4p4n I have another technique for sub commands I should write about too.