![]() |
VOOZH | about |
dotnet add package Redpoint.CommandLine --version 2026.1170.257
NuGet\Install-Package Redpoint.CommandLine -Version 2026.1170.257
<PackageReference Include="Redpoint.CommandLine" Version="2026.1170.257" />
<PackageVersion Include="Redpoint.CommandLine" Version="2026.1170.257" />Directory.Packages.props
<PackageReference Include="Redpoint.CommandLine" />Project file
paket add Redpoint.CommandLine --version 2026.1170.257
#r "nuget: Redpoint.CommandLine, 2026.1170.257"
#:package Redpoint.CommandLine@2026.1170.257
#addin nuget:?package=Redpoint.CommandLine&version=2026.1170.257Install as a Cake Addin
#tool nuget:?package=Redpoint.CommandLine&version=2026.1170.257Install as a Cake Tool
This library provides APIs for building dependency injected console applications, with both commands and option declarations being dependency injected.
To use this library, first define your command:
internal class SomeAction
{
public class Options
{
public Option<string> SomeOpt = new Option<string>("--opt", "My option description.");
// Add more fields or properties that use Option<> or Argument<> and they'll be automatically
// registered to the command line parser.
}
public static Command CreateCommand(ICommandBuilder builder)
{
return new Command("some-action", "The description of your some-action command.");
}
public class CommandInstance : ICommandInstance
{
private readonly ILogger<CommandInstance> _logger;
private readonly Options _options;
public CommandInstance(
ILogger<CommandInstance> logger,
Options options)
{
_logger = logger;
_options = options;
}
public Task<int> ExecuteAsync(ICommandInvocationContext context)
{
// Example on how to access an option's value.
var value = context.ParseResult.GetValueForOption(_options.SomeOpt);
// ... implement your command here ...
_logger.LogInformation("Hello world!");
// Return the exit code for the application.
return Task.FromResult(0);
}
}
}
To register and execute commands, in your Program.Main:
// Use the command line builder APIs to build the root command.
var rootCommand = CommandLineBuilder.NewBuilder()
.AddGlobalRuntimeServices((builder, services) =>
{
// Register global runtime services here, such as services.AddLogging(...)
})
.SetGlobalExecutionHandler(async (sp, executeCommand) =>
{
// Can be used to wrap execution of all commands, such as capturing
// exceptions and logging them:
var logger = sp.GetRequiredService<ILogger<Program>>();
try
{
return await executeCommand().ConfigureAwait(true);
}
catch (Exception ex)
{
logger.LogError(ex, $"Uncaught exception during command execution: {ex}");
return 1;
}
})
// Add each of your commands like this:
.AddCommand<SomeAction.CommandInstance, SomeAction.Options>(SomeAction.CreateCommand)
// Then build the root command to use below.
.Build("My console application description.");
// Parse and execute the command.
var exitCode = await rootCommand.InvokeAsync(args).ConfigureAwait(false);
await Console.Out.FlushAsync().ConfigureAwait(false);
await Console.Error.FlushAsync().ConfigureAwait(false);
Environment.Exit(exitCode);
throw new BadImageFormatException();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.1170.257 | 0 | 6/19/2026 |
| 2026.1169.464 | 62 | 6/18/2026 |
| 2026.1169.426 | 78 | 6/18/2026 |
| 2026.1169.413 | 75 | 6/18/2026 |
| 2026.1169.196 | 78 | 6/18/2026 |
| 2026.1161.947 | 91 | 6/10/2026 |
| 2026.1159.820 | 96 | 6/8/2026 |
| 2026.1159.804 | 98 | 6/8/2026 |
| 2026.1159.544 | 98 | 6/8/2026 |
| 2026.1159.510 | 93 | 6/8/2026 |
| 2026.1154.870 | 94 | 6/3/2026 |
| 2026.1154.811 | 91 | 6/3/2026 |
| 2026.1154.803 | 95 | 6/3/2026 |
| 2026.1154.686 | 97 | 6/3/2026 |
| 2026.1154.457 | 99 | 6/3/2026 |
| 2026.1153.1025 | 96 | 6/2/2026 |
| 2026.1153.1010 | 95 | 6/2/2026 |
| 2026.1153.988 | 95 | 6/2/2026 |
| 2026.1153.959 | 99 | 6/2/2026 |
| 2026.1153.916 | 95 | 6/2/2026 |