MintPlayer.CliGenerator
10.21.0
dotnet add package MintPlayer.CliGenerator --version 10.21.0
NuGet\Install-Package MintPlayer.CliGenerator -Version 10.21.0
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="MintPlayer.CliGenerator" Version="10.21.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MintPlayer.CliGenerator" Version="10.21.0" />
<PackageReference Include="MintPlayer.CliGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
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 MintPlayer.CliGenerator --version 10.21.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MintPlayer.CliGenerator, 10.21.0"
#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 MintPlayer.CliGenerator@10.21.0
#: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=MintPlayer.CliGenerator&version=10.21.0
#tool nuget:?package=MintPlayer.CliGenerator&version=10.21.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CLI command generators
Create structured CLI applications with nested commands and dependency injection support using the CliCommand source generator.
- Annotate your root command with
[CliRootCommand]and mark each command (and subcommand) with[CliCommand]. - Define command options with
[CliOption]and positional arguments with[CliArgument]on mutable properties. - Implement
MintPlayer.CliGenerator.Attributes.ICliCommandso each command exposes anExecute(CancellationToken)handler returning a task-based exit code. - Register your commands with the generated
Add<MyCommand>CommandTreeextension and invoke them through the generated helpers. - Use
[CliParentCommand(typeof(ParentCommand))]on a non-nested partial command class to attach it under an existing command without nesting the type in code. This enables splitting large command trees across multiple files.
[CliRootCommand(Name = "demo", Description = "Sample CLI")]
public partial class DemoCommand : ICliCommand
{
[CliOption("--verbose", "-v")] public bool Verbose { get; set; }
public Task<int> Execute(CancellationToken cancellationToken)
{
if (Verbose)
{
Console.WriteLine("Verbose mode active");
}
return Task.FromResult(0);
}
}
// In another file:
[CliCommand("greet", Description = "Greets a person")]
[CliParentCommand(typeof(DemoCommand))]
public partial class Greet : ICliCommand
{
private readonly IGreetingService greetingService;
public Greet(IGreetingService greetingService) => this.greetingService = greetingService;
[CliArgument(0)] public string Name { get; set; } = "world";
[CliOption("--times", DefaultValue = 1)] public int Times { get; set; }
public async Task<int> Execute(CancellationToken cancellationToken)
{
for (var i = 0; i < Times; i++)
await greetingService.GreetAsync(Name, cancellationToken);
return 0;
}
}
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddDemoCommandTree();
builder.Services.AddSingleton<IGreetingService, GreetingService>();
var app = builder.Build();
return await app.Services.InvokeDemoCommandAsync(args);
The generator creates:
- Scoped service registrations for all commands in the tree.
- Methods that build
System.CommandLinecommand hierarchies and wire options and arguments automatically. - Extensions on
IServiceCollectionandIServiceProviderto register and execute the command tree. - Recognition of non-nested partial command classes linked via
[CliParentCommand].
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- MintPlayer.CliGenerator.Attributes (>= 10.20.1)
- MintPlayer.ValueComparerGenerator.Attributes (>= 10.20.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 |
|---|---|---|
| 10.21.0 | 68 | 8/27/2026 |
| 10.20.1 | 69 | 8/27/2026 |
| 10.20.0 | 278 | 6/5/2026 |
| 10.19.0 | 129 | 4/3/2026 |
| 10.14.0 | 136 | 1/19/2026 |
| 10.13.0 | 126 | 1/19/2026 |
| 10.10.1 | 133 | 1/12/2026 |
| 10.10.0 | 138 | 1/12/2026 |
| 10.9.0 | 130 | 1/12/2026 |
| 10.8.0 | 258 | 11/14/2025 |
| 10.7.0 | 309 | 11/13/2025 |
| 10.5.0 | 309 | 11/11/2025 |
| 10.4.0 | 295 | 11/10/2025 |
| 10.3.0 | 221 | 11/6/2025 |
| 10.2.0 | 216 | 11/6/2025 |
| 10.1.1 | 215 | 11/6/2025 |
| 10.1.0 | 219 | 11/5/2025 |