McMaster.Extensions.CommandLineUtils 2.0.1

Command-line parsing API. A community-maintained fork of Microsoft.Extensions.CommandLineUtils, plus extras.
Commonly used types:

McMaster.Extensions.CommandLineUtils.CommandLineApplication
McMaster.Extensions.CommandLineUtils.CommandOption
McMaster.Extensions.CommandLineUtils.IConsole
McMaster.Extensions.CommandLineUtils.ArgumentEscaper

There is a newer version of this package available.
See the version list below for details.
Install-Package McMaster.Extensions.CommandLineUtils -Version 2.0.1
dotnet add package McMaster.Extensions.CommandLineUtils --version 2.0.1
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add McMaster.Extensions.CommandLineUtils --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Usage

See https://github.com/natemcmaster/CommandLineUtils for more examples.

CommandLineApplication is the main entry point for most console apps parsing.

using System;
using McMaster.Extensions.CommandLineUtils;

public class Program
{
    public static int Main(string[] args)
    {
        var app = new CommandLineApplication();

        app.HelpOption("-h|--help");
        var optionSubject = app.Option("-s|--subject <SUBJECT>", "The subject", CommandOptionType.SingleValue);

        app.OnExecute(() =>
        {
            var subject = optionSubject.HasValue()
                ? optionSubject.Value()
                : "world";

            Console.WriteLine($"Hello {subject}!");
            return 0;
        });

        return app.Execute(args);
    }
}

Usage

See https://github.com/natemcmaster/CommandLineUtils for more examples.

CommandLineApplication is the main entry point for most console apps parsing.

using System;
using McMaster.Extensions.CommandLineUtils;

public class Program
{
    public static int Main(string[] args)
    {
        var app = new CommandLineApplication();

        app.HelpOption("-h|--help");
        var optionSubject = app.Option("-s|--subject <SUBJECT>", "The subject", CommandOptionType.SingleValue);

        app.OnExecute(() =>
        {
            var subject = optionSubject.HasValue()
                ? optionSubject.Value()
                : "world";

            Console.WriteLine($"Hello {subject}!");
            return 0;
        });

        return app.Execute(args);
    }
}

Release Notes

2.0.1: Add .NETStandard 1.6 to the list of supported frameworks.

Showing the top 10 GitHub repositories that depend on McMaster.Extensions.CommandLineUtils:

Repository Stars
icsharpcode/ILSpy
.NET Decompiler
IdentityServer/IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
dotnet/BenchmarkDotNet
Powerful .NET library for benchmarking
microsoft/Quantum
Microsoft Quantum Development Kit Samples
ravendb/ravendb
ACID Document Database
xunit/xunit
xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework.
scriptcs/scriptcs
Write C# apps with a text editor, nuget and the power of Roslyn!
fluentmigrator/fluentmigrator
Fluent migrations framework for .NET
MichaCo/CacheManager
CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
tonerdo/coverlet
Cross platform code coverage for .NET

Version History

Version Downloads Last updated
2.4.0 104 9/14/2019
2.3.4 93,329 4/11/2019
2.3.3 39,992 3/11/2019
2.3.2 59,439 2/5/2019
2.3.1 16,503 1/19/2019
2.3.0 49,302 1/1/2019
2.2.5 223,720 7/2/2018
2.2.4 40,515 5/25/2018
2.2.3 18,930 5/11/2018
2.2.2 21,352 4/28/2018
2.2.1 9,744 4/11/2018
2.2.0 111,585 3/31/2018
2.2.0-rc 811 3/23/2018
2.2.0-beta 549 3/8/2018
2.2.0-alpha 523 2/20/2018
2.1.1 55,385 12/28/2017
2.1.0 1,945 12/13/2017
2.1.0-rc 499 12/7/2017
2.1.0-beta 1,457 11/22/2017
2.1.0-alpha 407 11/11/2017
2.0.1 5,718 10/13/2017
2.0.0 4,513 9/16/2017
Show less