A lightweight yet powerful and dynamic .NET command-line argument parser library that makes parsing arguments a breeze.
- Super quick and easy setup
- Supports both short (
-s) and long (--long) option styles - Built-in type validation for:
- Alphanumeric
- Integer
- Boolean
- Char
- Double
- Enumerated values (with custom allowed values)
- Flags (value-less switches)
- Automatically generated help section
- Handles:
- Required arguments
- Invalid/ignored arguments
- Missing arguments
Support for default values(coming soon)Customizable prefixes(coming soon)
var arguments = new ArgumentParser()
.AddAlphaOption("alpha", 'a', "An alphanumeric option")
.AddIntegerOption("integer", 'i', "An integer option")
.AddBooleanOption("boolean", 'b', "A boolean option")
.AddCharOption("char", 'c', "A char option")
.AddDoubleOption("double", 'd', "A double option")
.AddEnumerateOption("enumerate", 'e', "An enumerate option", ["accepted-value-1", "accepted-value-2"])
.AddFlagOption("flag", 'f', "A flag option")
.AddHelpOption("A description of the application.")
.AddVersionOption("1.2.3-alpha")
.Parse(args);$ Simple.ArgumentParser.Example.exe --helpPrints a clear and comprehensive help section with descriptions.
if (arguments.IsValid && arguments.Any())
{
Console.WriteLine("Valid commands:");
arguments.GetAll().ForEach(c =>
Console.WriteLine($"Name: {c.Name}, Type: {c.OptionType}, Value: {c.Value}"));
}if (arguments.HelpRequested)
{
Console.WriteLine(arguments.HelpSection);
return;
}
if (arguments.VersionRequested)
{
Console.WriteLine(arguments.Version);
return;
}if (arguments.HasInvalidCommands)
{
arguments.Invalid.ForEach(Console.WriteLine);
return;
}if (arguments.HasMissingCommands)
{
arguments.Missing.ForEach(Console.WriteLine);
return;
}if (arguments.HasIgnoredCommands)
{
Console.WriteLine("Ignored commands:");
arguments.Ignored.ForEach(c =>
Console.WriteLine($"Name: {c.Name}, Type: {c.OptionType}, Value: {c.Value}"));
}var specificCommand = arguments.Get("alpha");
Console.WriteLine($"Name: {specificCommand.Name}, Type: {specificCommand.OptionType}, Value: {specificCommand.Value}");Coming soon.
No handling of conflicting argument names✅ Resolved- Short names currently required — should be optional
- Only
--and-prefixes are supported — prefix customization not yet available
That's it – Simple.ArgumentParser is ready to make your CLI apps cleaner and easier to maintain!