Project DescriptionA powerful, declarative command-line parsing system in a single .cs file.
This file is available as a nuget package (package id: declcmdparser) and can be easily included or excluded in your project.
Example:
static void Main(string[] args)
{
...
args.Process(() =>
{
Console.WriteLine("Print usage here...");
Environment.Exit(-1);
},
new CommandLine.Switch("args1", v => saveArgs1Variable = v.First()),
new CommandLine.Switch("boolValue1", v => saveBoolValue1 = bool.Parse(v.First())),
new CommandLine.Switch("ListOfStringsArgs", v => saveListOfStringArgs = v.ToArray()),
new CommandLine.Switch("ComplexArgument", v =>
{
// Execute code here to perform actions with complex argument
...
}));
...
}