First, there is no built-in functionality for Guid
. Second, make sure you're using the latest version 2.6.0.5
. You can install it through nuget -> search for "CommandLineArgumentsParser".
Once you've installed the latest version, you can interpret custom structures as such:
var parser = new CommandLineParser.CommandLineParser();
var guidArgument = new ValueArgument<Guid>('g', "guid", "Guid of something");
guidArgument.ConvertValueHandler = Guid.Parse;
parser.Arguments.Add(guidArgument);
parser.ParseCommandLine(args);
// the actual guid from command line.
var parsedGuid = guidArgument.Value;
If you want to keep your current version, you need to treat Guid
as string
when parsing, and later do custom validation
by yourself.
http://commandlineparser.codeplex.com/wikipage?title=More%20thorough%20examples&referringTitle=Home