-
Notifications
You must be signed in to change notification settings - Fork 1
Small, simple command line argument parsing utility for .NET
License
authorunknown/Args
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Args - Small, simple command line argument parsing utility for .NET
Licensed under MIT license.
Sample usage:
class Program
{
static int Main(string[] args)
{
Args arguments = new Args("sample program that will echo an integer");
var numberArgument = arguments.Add<int>("n", "number", "some random number", true);
arguments.Parse(args);
if (!arguments.IsValid)
{
arguments.PrintUsage(System.Console.Error);
return 1;
}
int n = numberArgument.Value;
System.Console.WriteLine(n);
}
}
Results of valid arguments:
---------------------------
> SampleProgram.exe /n 3
3
> SampleProgram.exe -n 3
3
> SampleProgram.exe /number 3
3
> SampleProgram.exe -number 3
3
> SampleProgram.exe /n:3
3
> SampleProgram.exe -n:3
3
> SampleProgram.exe /number:3
3
> SampleProgram.exe -number:3
3
Results of invalid arguments:
-----------------------------
> SampleProgram.exe 3
SampleProgram - sample program that will echo an integer
usage: SampleProgram -n <int>
n, number - int; required. some random number
>SampleProgram.exe n foo
SampleProgram - sample program that will echo an integer
usage: SampleProgram -n <int>
n, number - int; required. some random number
About
Small, simple command line argument parsing utility for .NET
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published