Upstream.CommandLine 2.0.0-alpha

This is a prerelease version of Upstream.CommandLine.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Upstream.CommandLine --version 2.0.0-alpha                
NuGet\Install-Package Upstream.CommandLine -Version 2.0.0-alpha                
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="Upstream.CommandLine" Version="2.0.0-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Upstream.CommandLine --version 2.0.0-alpha                
#r "nuget: Upstream.CommandLine, 2.0.0-alpha"                
#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 Upstream.CommandLine as a Cake Addin
#addin nuget:?package=Upstream.CommandLine&version=2.0.0-alpha&prerelease

// Install Upstream.CommandLine as a Cake Tool
#tool nuget:?package=Upstream.CommandLine&version=2.0.0-alpha&prerelease                

upstream-command-line

nuget Publish Package status Run Tests status

A wrapper around System.CommandLine to allow for large, service-oriented application development. Some of the benefits of this package include:

  • Native IOC support: All commands are registered and instatiated via the ServiceProvider.
  • Attribute-based command declaration: Commands can be configured via readable, statically typed classes—no more mapping classes to functional configuration methods.
  • Leverage System.CommandLine: This is not a fork, but a flexible wrapper around the .NET Foundation sponsored System.CommandLine library. This means that your application will benefit from the continued development/maturity of that project, and can benefit from integrations like dotnet-suggest out of the box. If you wish to switch to a vanilla System.CommandLine implementation down the road, the migration is straightforward.

Setup

Add the package as a dependency to your .NET project via the following command:

dotnet add package Upstream.CommandLine --prerelease

Usage

Refer to the Sample project for a working example of this package. The following is a simple (non-functional) example of how to configure an Upstream.CommandLine console application that uses dependency injected services:

public static class Program
{
    public static Task Main(string[] args)
    {
        return new CommandLineApplication()
            .AddCommand<FooCommand, FooOptions>("foo")
            .ConfigureServices(services =>
            {
                services.AddTransient<IBarService, BarService>();
            })
            .InvokeAsync(args);
    }
}

public class FooOptions
{
    [Argument(Description = "Drink order at the Bar")]
    public string Drink { get; set; }
}

public class FooCommand : CommandBase<FooOptions>
{
    private readonly IBarService _barService;

    public FooCommand(IBarService barService)
    {
        _barService = barService;
    }

    protected override Task ExecuteAsync(CancellationToken cancellationToken)
    {
        cancellationToken.ThrowIfCancellationRequested();

        Console.WriteLine($"Foo walks into a Bar and orders a {_barService.Order(Options.Drink)}");

        return Task.CompletedTask;
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 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 was computed. 
.NET Framework 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.2.1 246 10/20/2023
2.1.0 392 11/18/2022
2.0.1 108 10/31/2022
2.0.0 721 5/17/2022
2.0.0-beta3 127 5/16/2022
2.0.0-beta2 122 5/13/2022
2.0.0-beta1 116 5/12/2022
2.0.0-alpha 120 5/1/2022
1.2.2 155 4/14/2022
1.2.1 165 4/14/2022
1.2.0 221 4/29/2021
1.1.0 344 1/30/2020
1.1.0-alpha1 307 1/30/2020
1.0.0 342 1/6/2020