Table of Contents

How it works

The library is very simple in its usage. The definition of command-line switches is based on generic C# types. The parser fully analyze the command line searching for switches and arguments. A special case is the one where the swithes can be inserted within an external file listing the switches line-by-line. To see a real application of the library look at project JCOReflectorCLI and JCOReflectorEngine

Argument definition

An argument can be defined using the following syntax sinppets:

arg = new ArgumentMetadata<bool>()
{
	Name = "test",
	ShortName = "tst",
	Help = "this is a test",
	Type = ArgumentType.Double,
	ValueType = ArgumentValueType.Free,
}

arg1 = new ArgumentMetadata<int>()
{
	Name = "range",
	Default = 9,
	Type = ArgumentType.Double,
	ValueType = ArgumentValueType.Range,
	MinValue = 2,
	MaxValue = 10,
}

Parser initialization

Upon arguments are defined they can be added to the list managed from the parser using:

Parser.Add(arg);

or the compact version:

arg1.Add();

Parser use

Then it is possible to use the parser on command-line arguments:

Parser.Parse(args);

or the compact version:

args.Parse();

Argument check

When the Parse method returns, a list of prepared arguments is available. The list can be used to get value or check for existence.