Monarch 3.0.73

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

// Install Monarch as a Cake Tool
#tool nuget:?package=Monarch&version=3.0.73

Monarch

.NET Publish Coverage Status

Monarch is a command line parser/task runner.

Basic Usage

In order to use the system, you need to register it with your ServiceCollection:

serviceCollection.AddCanisterModules();
				

This is required prior to using the Monarch class for the first time. Once it is wired up, you can use the CommandRunner class:

var Instance = new CommandRunner();
return Instance.Run(args);

The CommandRunner class has a Run method which parses the args passed in and runs the appropriate command. The library has help and version commands built in to the system, however to create your own commands you need to create a command and also an input class:

public class TestCommand : CommandBaseClass<TestInput>
{
    public override string[] Aliases => new string[] { "Test" };

    public override string Description => "Test command";

    public override string Name => "Test Command";

    protected override async Task<int> Run(TestInput input)
    {
        await Task.CompletedTask;
        Console.WriteLine(input.Value1);
        Console.WriteLine(input.Value2);
        Console.WriteLine(input.Value3.ToString(x => x));
        return 0;
    }
}

public class TestInput
{
    [Display(Description = "Value 1 Property")]
    public int Value1 { get; set; }

    [Display(Description = "Value 2 Property")]
    public string Value2 { get; set; }

    [Display(Description = "Value 3 Property")]
    [MaxLength(3)]
    public List<string> Value3 { get; set; }
}

The command above inherits from the CommandBaseClass and defines the input that it expects. In this case TestInput. TestInput is how the command line arguments should be parsed by the system. The commands must define the aliases, description, and name for the command. The TestInput then defines properties and uses the DisplayAttribute from the System.ComponentModel.DataAnnotations namespace to define information. Also any data annotations defining max length, required, etc. are used to validate the input.

Options

By default the system does not require you to set options. However you can specify some options found within the system including command prefix, flag prefix, and indentation amount. In order to override what is in the system just create a class that inherits from IOptions:

public class DefaultOptions : IOptions
{
    /// <summary>
    /// Gets the command prefix.
    /// </summary>
    /// <value>The command prefix.</value>
    public string CommandPrefix { get; } = "";

    /// <summary>
    /// Gets the flag prefix.
    /// </summary>
    /// <value>The flag prefix.</value>
    public string FlagPrefix { get; } = "-";

    /// <summary>
    /// Gets the indent amount.
    /// </summary>
    /// <value>The indent amount.</value>
    public int IndentAmount { get; } = 4;
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Monarch:

Package Downloads
TaskMaster

TaskMaster is a simple library used to manage sets of fire and forget tasks that need to run after specific dates/times.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.73 87 4/14/2024
3.0.72 52 4/12/2024
3.0.71 82 4/11/2024
3.0.70 105 4/1/2024
3.0.69 105 3/29/2024
3.0.68 135 3/18/2024
3.0.67 112 3/15/2024
3.0.66 102 3/14/2024
3.0.65 125 3/11/2024
3.0.64 116 3/8/2024
3.0.63 110 3/7/2024
3.0.62 107 3/6/2024
3.0.61 96 3/5/2024
3.0.60 81 3/4/2024
3.0.59 207 2/29/2024
3.0.58 107 2/28/2024
3.0.57 92 2/26/2024
3.0.56 126 2/23/2024
3.0.55 97 2/22/2024
3.0.54 81 2/21/2024
3.0.53 198 2/15/2024
3.0.52 117 2/12/2024
3.0.51 130 2/8/2024
3.0.50 103 2/7/2024
3.0.49 115 2/6/2024
3.0.48 139 2/1/2024
3.0.47 177 1/24/2024
3.0.46 93 1/23/2024
3.0.45 182 1/11/2024
3.0.44 266 12/19/2023
3.0.43 140 12/14/2023
3.0.42 117 12/13/2023
3.0.41 252 11/24/2023
3.0.40 158 11/21/2023
3.0.39 97 11/20/2023
3.0.38 131 11/17/2023
3.0.37 126 11/16/2023
3.0.36 121 11/15/2023
3.0.35 192 11/9/2023
3.0.34 147 11/7/2023
3.0.33 115 11/6/2023
3.0.32 189 11/1/2023
3.0.31 123 10/31/2023
3.0.30 126 10/30/2023
3.0.29 153 10/26/2023
3.0.28 172 10/12/2023
3.0.27 204 9/26/2023
3.0.26 131 9/20/2023
3.0.25 133 9/19/2023
3.0.24 126 9/18/2023
3.0.23 156 9/14/2023
3.0.22 132 9/13/2023
3.0.21 140 9/12/2023
3.0.20 140 9/11/2023
3.0.19 179 9/7/2023
3.0.18 138 9/6/2023
3.0.17 132 9/5/2023
3.0.16 135 9/4/2023
3.0.15 150 9/1/2023
3.0.14 138 8/31/2023
3.0.13 141 8/30/2023
3.0.12 151 8/29/2023
3.0.11 159 8/28/2023
3.0.10 185 8/23/2023
3.0.9 185 8/18/2023
3.0.8 186 8/16/2023
3.0.7 168 8/9/2023
3.0.6 167 8/8/2023
3.0.5 113 8/8/2023
3.0.4 172 8/7/2023
3.0.3 188 8/4/2023
3.0.2 247 7/26/2023
3.0.1 251 7/14/2023
3.0.0 374 12/12/2022
2.0.16 415 6/10/2022
2.0.14 280 1/11/2022
2.0.13 1,270 1/11/2022
2.0.12 737 1/10/2022
2.0.10 606 6/21/2021
2.0.8 332 6/21/2021
2.0.6 643 1/6/2021
2.0.5 989 9/13/2020
2.0.4 702 3/29/2020
2.0.3 987 3/25/2020
2.0.2 751 3/3/2020
2.0.1 1,394 12/31/2019
2.0.0 963 12/23/2019
1.0.7 1,058 8/31/2018
1.0.6 731 8/31/2018
1.0.5 734 8/31/2018