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.
Sadly there's no built in support for handling that in a standard manner. Have you looked into PowerShell? I bet there's a class in that shell which does exactly what you want or something similar.
Have a look at ndesk.options.
It is called Mono.Options now.
Edit: as fatcat1111 points out, this feature did not ship with the final version of .net 4.0.
C# 4.0 has a pretty good one. Probably not very helpful yet, but you might want to consider looking at something that will make the jump to the built in one easy when it comes out. Bart De Smet talked about it on his B# blog
A popular and pretty comprehensive C command-line parser is GNU getopt. This has been ported (or cloned) for C#/.Net several times. Some of these include:
Take your pick! There are several others, and google can tell you about those,
I suggest NDesk.Options
look here:
Best way to parse command line arguments in C#?
The BizArk library contains a command-line parser.
Basically you just create a class that inherits from CmdLineObject, add properties that you want populated from the command-line, add a CmdLineArgAttribute to the properties, then call Initialize in your program. It supports ClickOnce URL arguments too!
Features (from the site)...