Upstream.CommandLine
1.2.2
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 1.2.2
NuGet\Install-Package Upstream.CommandLine -Version 1.2.2
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="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Upstream.CommandLine --version 1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Upstream.CommandLine, 1.2.2"
#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=1.2.2 // Install Upstream.CommandLine as a Cake Tool #tool nuget:?package=Upstream.CommandLine&version=1.2.2
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 --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 | Versions 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
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 |