CommandLineEngine 1.1.0

dotnet add package CommandLineEngine --version 1.1.0
NuGet\Install-Package CommandLineEngine -Version 1.1.0
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="CommandLineEngine" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CommandLineEngine --version 1.1.0
#r "nuget: CommandLineEngine, 1.1.0"
#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 CommandLineEngine as a Cake Addin
#addin nuget:?package=CommandLineEngine&version=1.1.0

// Install CommandLineEngine as a Cake Tool
#tool nuget:?package=CommandLineEngine&version=1.1.0

Features:

  • Minimal attributes required for basic functionnality
  • Automatic mapping of command and parameter name
  • Automatic recognition of optional parameters
  • Automatically generated help page (can also be customized)
  • Ability to hide optional parameter from help (such as debug parameters)
  • Many advanced customizations available

Getting started

In your code, simply add the [Command] attribute on all methods or functions you wish to identify a command. By default, all parameters in the function will become arguments that can be passed on the command line. Then, in the Main method, call CommandExecutor.Execute(args);

Basic functionnality

class Program
{
    static void Main(string[] args)
    {
        CommandLineEngine.CommandExecutor.Execute(args);
    }

    [Command]
    static void SayHello(string name)
    {
        Console.WriteLine($"Hello {name}");
    }

    [Command]
    static void SayGoodbye(string name)
    {
        Console.WriteLine($"Goodbye {name}!");
    }
}

Assuming the code compiles to MyApp.exe, we can simply call

MyApp.exe SayHello --name UserName
Output: Hello UserName!

It is also possible to request help by passing the --help tag, either globally or for a particular command

MyApp.exe --help
or
MyApp.exe SayHello --help

Basic customizations

The following attributes allow you to customize the command and the parameters

Command Attribute

  • Name | Allows you to override the name of the command, by default, uses the method name.
  • Description | Allows you to specify a description for the method, will be shown in help.
  • HelpUrl | Allows you to specify a URL for more information, will be shown in help.

Parameter Attribute

  • Name | Allows you to override the name of the parameter, by default, uses the parameter name. Passed as --name value.
  • ShortName | Allows you to specify a a short name for the parameter. Passed as -shortName value.
  • Description | Allows you to specify a description for the parameter, will be shown in help.

Advanced customizations

See wiki for more customizations available.

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 netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.6 is compatible.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  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 tizen30 was computed.  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
1.1.0 707 5/16/2019
1.0.0.1 655 5/16/2019
1.0.0.1-rc 435 4/11/2019
1.0.0 928 5/16/2019
1.0.0-rc 438 4/10/2019