Upstream.CommandLine
2.0.0-beta1
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
This is a prerelease version of Upstream.CommandLine.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Upstream.CommandLine --version 2.0.0-beta1
NuGet\Install-Package Upstream.CommandLine -Version 2.0.0-beta1
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-beta1" />
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-beta1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Upstream.CommandLine, 2.0.0-beta1"
#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-beta1&prerelease // Install Upstream.CommandLine as a Cake Tool #tool nuget:?package=Upstream.CommandLine&version=2.0.0-beta1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
upstream-command-line
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
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>()
.ConfigureServices(services =>
{
services.AddSingleton<IBarService, BarService>();
})
.InvokeAsync(args);
}
}
[Command("foo")]
public class FooCommand
{
[Argument(Description = "Drink order at the Bar")]
public string Drink { get; set; }
}
public class FooCommandHandler : CommandHandler<FooCommand>
{
private readonly IBarService _barService;
public FooCommand(IBarService barService)
{
_barService = barService;
}
protected override async Task<int> ExecuteAsync(FooCommand command, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
Console.WriteLine($"Foo walks into a Bar and orders a {command.Drink}");
await _barService.OrderAsync(command.Drink);
return 0;
}
}
Product | Versions 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.
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- System.CommandLine (>= 2.0.0-beta3.22114.1)
- System.CommandLine.Hosting (>= 0.4.0-alpha.22114.1)
-
net6.0
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- System.CommandLine (>= 2.0.0-beta3.22114.1)
- System.CommandLine.Hosting (>= 0.4.0-alpha.22114.1)
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 | 242 | 10/20/2023 |
2.1.0 | 390 | 11/18/2022 |
2.0.1 | 106 | 10/31/2022 |
2.0.0 | 719 | 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 | 153 | 4/14/2022 |
1.2.1 | 163 | 4/14/2022 |
1.2.0 | 219 | 4/29/2021 |
1.1.0 | 342 | 1/30/2020 |
1.1.0-alpha1 | 307 | 1/30/2020 |
1.0.0 | 340 | 1/6/2020 |