4 ms·
Painless Command Line Argument Parsing in C
- kennu 16y agoBasically same as GNU getopt which has existed 25 years? Please use standard libraries for things like this.
- Anilm3 16y agoSoftware reuse is a great thing, but not to the point of criminalizing learning.
- jhrobert 16y ago"The whole concept behind this is to have a very painless way to parse command line arguments, possibly by losing some flexibility." 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.
- kennu 16y agoI didn't see any mention of getopt in the readme, so I figured the author was perhaps just unaware of it. I don't consider getopt particularly painful myself, especially since you can use it on Unix-like plaforms out-of-the-box. 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.
- startupgrrl 16y agoBut why isn't this written in Ruby?
- robyates 16y agoIt looks similar to args4j in Java: http://www.whenbrainsfly.com/2009/05/args4j-is-magic/ http://www.whenbrainsfly.com/2009/05/args4j-is-magic/