Monarch 4.0.5

dotnet add package Monarch --version 4.0.5
                    
NuGet\Install-Package Monarch -Version 4.0.5
                    
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="4.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Monarch" Version="4.0.5" />
                    
Directory.Packages.props
<PackageReference Include="Monarch" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Monarch --version 4.0.5
                    
#r "nuget: Monarch, 4.0.5"
                    
#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.
#:package Monarch@4.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Monarch&version=4.0.5
                    
Install as a Cake Addin
#tool nuget:?package=Monarch&version=4.0.5
                    
Install as a Cake Tool

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.RegisterMonarch();

Or if you are using Canister:

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 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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
4.0.5 192 1/21/2026
4.0.4 122 1/21/2026
4.0.3 686 9/20/2025
4.0.2 532 6/27/2025
4.0.1 636 1/15/2025
4.0.0 497 11/24/2024
3.0.116 299 11/13/2024
3.0.115 233 11/12/2024
3.0.114 219 11/11/2024
3.0.113 222 11/8/2024
3.0.112 220 11/6/2024
3.0.111 339 11/4/2024
3.0.110 282 10/31/2024
3.0.109 267 10/30/2024
3.0.108 184 10/29/2024
3.0.107 218 10/29/2024
3.0.106 394 10/11/2024
3.0.105 248 10/10/2024
3.0.104 579 9/9/2024
3.0.103 337 8/29/2024
3.0.102 278 8/27/2024
3.0.101 285 8/26/2024
3.0.100 329 8/22/2024
3.0.99 268 8/21/2024
3.0.98 264 8/20/2024
3.0.97 297 8/15/2024
3.0.96 350 8/5/2024
3.0.95 327 7/25/2024
3.0.94 296 7/11/2024
3.0.93 415 6/27/2024
3.0.92 240 6/26/2024
3.0.91 315 6/21/2024
3.0.90 259 6/19/2024
3.0.89 269 6/18/2024
3.0.88 287 6/17/2024
3.0.87 265 6/14/2024
3.0.86 246 6/13/2024
3.0.85 353 5/31/2024
3.0.84 355 5/30/2024
3.0.83 269 5/17/2024
3.0.82 233 5/16/2024
3.0.81 304 5/8/2024
3.0.80 268 5/7/2024
3.0.79 294 5/6/2024
3.0.78 253 5/3/2024
3.0.77 208 5/2/2024
3.0.76 219 5/1/2024
3.0.75 287 4/30/2024
3.0.74 262 4/30/2024
3.0.73 356 4/14/2024
3.0.72 198 4/12/2024
3.0.71 255 4/11/2024
3.0.70 334 4/1/2024
3.0.69 241 3/29/2024
3.0.68 336 3/18/2024
3.0.67 253 3/15/2024
3.0.66 245 3/14/2024
3.0.65 290 3/11/2024
3.0.64 272 3/8/2024
3.0.63 296 3/7/2024
3.0.62 279 3/6/2024
3.0.61 235 3/5/2024
3.0.60 215 3/4/2024
3.0.59 428 2/29/2024
3.0.58 241 2/28/2024
3.0.57 245 2/26/2024
3.0.56 283 2/23/2024
3.0.55 235 2/22/2024
3.0.54 223 2/21/2024
3.0.53 444 2/15/2024
3.0.52 278 2/12/2024
3.0.51 308 2/8/2024
3.0.50 234 2/7/2024
3.0.49 246 2/6/2024
3.0.48 311 2/1/2024
3.0.47 430 1/24/2024
3.0.46 223 1/23/2024
3.0.45 402 1/11/2024
3.0.44 456 12/19/2023
3.0.43 301 12/14/2023
3.0.42 254 12/13/2023
3.0.41 412 11/24/2023
3.0.40 279 11/21/2023
3.0.39 233 11/20/2023
3.0.38 240 11/17/2023
3.0.37 276 11/16/2023
3.0.36 220 11/15/2023
3.0.35 350 11/9/2023
3.0.34 275 11/7/2023
3.0.33 205 11/6/2023
3.0.32 333 11/1/2023
3.0.31 219 10/31/2023
3.0.30 261 10/30/2023
3.0.29 308 10/26/2023
3.0.28 314 10/12/2023
3.0.27 349 9/26/2023
3.0.26 276 9/20/2023
3.0.25 234 9/19/2023
3.0.24 245 9/18/2023
3.0.23 315 9/14/2023
3.0.22 279 9/13/2023
3.0.21 232 9/12/2023
3.0.20 285 9/11/2023
3.0.19 347 9/7/2023
3.0.18 259 9/6/2023
3.0.17 244 9/5/2023
3.0.16 257 9/4/2023
3.0.15 274 9/1/2023
3.0.14 252 8/31/2023
3.0.13 285 8/30/2023
3.0.12 300 8/29/2023
3.0.11 273 8/28/2023
3.0.10 344 8/23/2023
3.0.9 356 8/18/2023
3.0.8 314 8/16/2023
3.0.7 306 8/9/2023
3.0.6 286 8/8/2023
3.0.5 215 8/8/2023
3.0.4 321 8/7/2023
3.0.3 336 8/4/2023
3.0.2 432 7/26/2023
3.0.1 419 7/14/2023
3.0.0 551 12/12/2022
2.0.16 602 6/10/2022
2.0.14 501 1/11/2022
2.0.13 1,553 1/11/2022
2.0.12 949 1/10/2022
2.0.10 897 6/21/2021
2.0.8 504 6/21/2021
2.0.6 860 1/6/2021
2.0.5 1,278 9/13/2020
2.0.4 931 3/29/2020
2.0.3 1,265 3/25/2020
2.0.2 995 3/3/2020
2.0.1 1,726 12/31/2019
2.0.0 1,222 12/23/2019
1.0.7 1,367 8/31/2018
1.0.6 1,004 8/31/2018
1.0.5 979 8/31/2018