I'm looking for a command line argument parser, such as "Command line parser" from http://www.sellsbrothers.com/tools/Genghis/ .
Features I'm looking for:
- Auto-generation of usage
- Should able to check required and optional parameters
- Parameters should support IEnumerable with separator support
- Should support flag parameters
- Would be nice to support combining parameters such as "/fx" == "/f /x"
- Would be nice to not force for a space after a parameter such as "/ftest.txt" == "/f test.txt"
P.S : "Command line parser" is quite good, I really like the design of it but there is no documentation, no new updates and I couldn't figure out to do certain stuff such as how to check for required parameters.
I'm betting this is not quite what you're looking for, but:
Somebody here had that problem, and his first thought was "hey, ocaml has a pretty good one!", and quickly ported it to F#.
You may like my one Rug.Cmd
Easy to use and expandable command line argument parser. Handles: Bool, Plus / Minus, String, String List, CSV, Enumeration.
Built in '/?' help mode.
Built in '/??' and '/?D' document generator modes.
Edit: This is my project and as such this answer should not be seen as an endorsement from a third party. That said I do use it for every command line based program I write, it is open source and it is my hope that others may benefit from it.
I'm a fan of the C# port to OptParse, a built in library in Python. It's rather simple to use compared to most of the other suggestions here and contains a number of useful features in addition to just auto parsing.
My personal favourite 3rd party commandline parsing library is Command Line Parser and I assume this is the one you are referring to. The most recent release was less than 2 months ago and there are regular commits. If you want a more mature offering you could chek out the console library in the mono project (sorry I can't seem to find a direct link to the namespace at the moment, but its a part of the mono framework)
Consider that once you start using this parser, you'll either have to maintain it yourself, or else depend on someone else to maintain it for you. You may be better off writing your own, starting from your most critical, immediate, requirements. I've found that it doesn't take too much work to produce some fairly complicated command-line parsing for most console-based applications I've worked on.
I've also found that when the parsing gets too complicated, it may be time to stop using the command line.
I'm using the parser out of the C# 3.0 cookbook.
All the examples from this book can be downloaded here: http://examples.oreilly.com/9780596516109/
Search for 'Arguments' and you'll find it. You have to do some little code changes to get it out of the whole thing into your own class, but this is no big problem.
It supports all your points except the last two ones (parameter combining & missing space).