MSPro.CLArgs 1.2008.5.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package MSPro.CLArgs --version 1.2008.5.2
NuGet\Install-Package MSPro.CLArgs -Version 1.2008.5.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MSPro.CLArgs" Version="1.2008.5.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MSPro.CLArgs --version 1.2008.5.2
#r "nuget: MSPro.CLArgs, 1.2008.5.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MSPro.CLArgs as a Cake Addin
#addin nuget:?package=MSPro.CLArgs&version=1.2008.5.2

// Install MSPro.CLArgs as a Cake Tool
#tool nuget:?package=MSPro.CLArgs&version=1.2008.5.2

CLArgs - A dotnet command-line interpreter

Console Applications are simple: static void Main(string[] args) .. and go! However, getting arguments from a command-line can be complex. Simply run dotnet build --help and see!

CLArgs turns your console application ​ into a modern command-line application ​ with minimal coding effort ​ while providing maximum flexibility and extensibility.

c:\ > YourApp.exe --country=Germany --count=3

internal static class Program
{
	private static void Main(string[] args)
	{
		// Parse the command-line
		Arguments arguments = CommandLineParser.Parse(args);
		// Create a command (that contains the functionality)
		var cmd = new HelloWorldCommand();
		// Let CLArgs convert the arguments and run the command.
		cmd.Execute(arguments);
	}
}

internal class HelloWorldParameters
{
	[OptionDescriptor("country", "c", Required = true)]
	public string Country { get; set; }

	[OptionDescriptor("count", Required = false, Default = 1)]
	public int Count { get; set; }
}

internal class HelloWorldCommand : CommandBase<HelloWorldParameters>
{
	protected override void Execute(HelloWorldParameters ps)
	{
		for (int i = 0; i < ps.Count; i++)
			Console.WriteLine($"Hello {ps.Country}!");
	}
}

See Simple-As-That Source-Code / Sample Project / All Samples.

Continue reading documentation

Feature List

  • A single line of code does the trick: Commander.ExecuteCommand( args);
  • Unlimited number of Verbs
  • Plug-In concept: Automatic Command resolution based on Verbs
  • Different argument-sets for each Command
    • Command Parameter classes support
      • Sub-Classes (inheritance)
  • Flexible argument validation and completion
  • Clean error-handling to report all errors instead of only the first one
    • When using a console application, It can be frustrating to see "Param1 is missing" and once you fixed it you get: "Param2 is missing".
    • CLArgs reports all errors in a single run.
  • Support for command and argument help-text
    • Help-Texts and argument definitions can be loaded from files, from Resources or they can be build-in by code or a combination of these.
    • This includes support for localized help-messages.
  • Support for custom property types and enums in your parameter classes
  • Support converting custom value converters
    • to convert any command-line string-value into any Type
  • Dynamic default values (not only static, like True, "abc")
    • Including depend default values, e. g. on other values
  • ...

<sub>Markus Schmidt (PRO), Munich (DE), 2020-07-10</sub>

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2312.16 185 12/16/2023
2.2208.2 463 8/24/2022
1.2112.2 303 12/11/2021
1.2109.7 301 9/7/2021
1.2104.12.1 298 4/12/2021
1.2104.9.1 320 4/10/2021
1.2012.29.1 339 12/29/2020
1.2009.8.1 403 9/8/2020
1.2008.5.2 457 8/5/2020

Help support added, fixes null Descriptions