Ookii.CommandLine is a command prompt utility designed to provide comprehensive command line argument parsing for .Net applications. It allows you to easily define required, optional, positional and named arguments, parse the command line, and generate usage information.
Ookii.CommandLine can be used with any kind of .Net application, whether Console, Windows Forms, or WPF. Although a limited subset of functionality – particularly related around generating usage help text – is geared primarily towards console applications that are invoked from the command prompt, the main command line parsing functionality is usable in any application that needs to process command line arguments.
To define a set of command line arguments, you create a class that will hold their values. The constructor parameters and properties of that class determine the set of arguments that are accepted. Attributes can be used to specify things such as the argument name and whether or not an argument is required, and to specify descriptions used to customize the usage help.
Command line parsing is done in a way that is similar to that used by Windows PowerShell. Each argument has a name, and can be supplied by name on the command line. An argument can also be positional, in which case it can be supplied without the name.
Arguments can be required or optional, and there is support for switch arguments (which don't need a value but are either present or not) and arguments with multiple values. Various aspects of the parsing, such as the argument name prefix (typically a / or a -), can be customized.
Requirements:
· Microsoft .Net Framework 2.0 or later
· Mono 2.6 or later
What's New in This Release: [ read full changelog ]
· Added support for dictionary arguments; these are special multi-value arguments whose values take the form key=value.
· Multi-value arguments can be specified using a read-only property of any collection type (in addition to the previous array support).
· Multi-value properties can optionally use a separator character to allow multiple values to be specified without specifying the argument multiple times.
· Added support for specifying a custom type converter for individual arguments.
· When specifying the default value for an argument defined by a property you can now use any type that can be converted to the argument’s type using its type converter. This makes it possible to define default values for arguments with a type for which there are no literals.
· A CommandLineArgumentException is thrown when the argument type’s constructor or a property setter throws an exception (instead of a TargetInvocationException).
· The CommandLineParser no longer sets the property value for an unspecifi...