Redpoint.CommandLine 2025.1002.636

Prefix Reserved
dotnet add package Redpoint.CommandLine --version 2025.1002.636                
NuGet\Install-Package Redpoint.CommandLine -Version 2025.1002.636                
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="Redpoint.CommandLine" Version="2025.1002.636" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Redpoint.CommandLine --version 2025.1002.636                
#r "nuget: Redpoint.CommandLine, 2025.1002.636"                
#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 Redpoint.CommandLine as a Cake Addin
#addin nuget:?package=Redpoint.CommandLine&version=2025.1002.636

// Install Redpoint.CommandLine as a Cake Tool
#tool nuget:?package=Redpoint.CommandLine&version=2025.1002.636                

Redpoint.CommandLine

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 Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.

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
2025.1002.636 43 1/2/2025
2025.1001.1435 41 1/2/2025
2025.1001.1397 40 1/1/2025
2025.1001.770 56 1/1/2025
2025.1001.570 69 1/1/2025
2025.1001.558 58 1/1/2025
2025.1001.421 67 1/1/2025
2025.1001.390 60 1/1/2025
2025.1001.234 71 1/1/2025
2025.1001.123 70 1/1/2025
2024.1360.354 69 12/25/2024
2024.1360.60 72 12/25/2024
2024.1360.32 74 12/25/2024
2024.1358.450 81 12/23/2024
2024.1358.359 73 12/23/2024
2024.1358.312 74 12/23/2024
2024.1358.244 72 12/23/2024
2024.1358.120 81 12/23/2024
2024.1348.253 77 12/13/2024
2024.1345.1379 76 12/10/2024
2024.1345.506 79 12/10/2024
2024.1345.379 73 12/10/2024
2024.1345.145 74 12/10/2024
2024.1345.72 79 12/10/2024
2024.1345.69 70 12/10/2024
2024.1345.15 77 12/10/2024
2024.1344.1436 78 12/10/2024
2024.1344.600 87 12/9/2024
2024.1344.411 75 12/9/2024
2024.1340.379 86 12/5/2024
2024.1340.15 85 12/5/2024
2024.1338.786 82 12/3/2024
2024.1338.722 91 12/3/2024
2024.1338.697 84 12/3/2024
2024.1338.639 86 12/3/2024
2024.1338.541 85 12/3/2024
2024.1338.318 75 12/3/2024
2024.1338.298 80 12/3/2024
2024.1338.98 88 12/3/2024
2024.1337.756 85 12/2/2024
2024.1337.634 84 12/2/2024
2024.1337.625 84 12/2/2024
2024.1337.621 87 12/2/2024
2024.1337.594 81 12/2/2024
2024.1337.136 67 12/2/2024
2024.1336.793 84 12/1/2024
2024.1336.773 85 12/1/2024
2024.1336.305 83 12/1/2024
2024.1336.12 90 12/1/2024
2024.1335.1421 84 11/30/2024
2024.1335.1384 82 11/30/2024
2024.1334.1308 80 11/29/2024
2024.1334.764 84 11/29/2024
2024.1334.722 85 11/29/2024
2024.1330.185 83 11/25/2024
2024.1328.505 82 11/23/2024
2024.1328.470 85 11/23/2024
2024.1328.452 84 11/23/2024
2024.1323.910 84 11/18/2024
2024.1323.653 77 11/18/2024
2024.1323.185 86 11/18/2024
2024.1323.49 75 11/18/2024
2024.1322.714 87 11/17/2024
2024.1320.653 83 11/15/2024
2024.1320.619 73 11/15/2024
2024.1320.601 84 11/15/2024
2024.1320.159 80 11/15/2024
2024.1320.98 77 11/15/2024
2024.1320.2 75 11/15/2024
2024.1319.1431 78 11/15/2024
2024.1319.1335 76 11/14/2024
2024.1317.631 86 11/12/2024
2024.1316.330 101 11/11/2024
2024.1311.540 92 11/6/2024
2024.1306.225 88 11/1/2024
2024.1306.199 88 11/1/2024
2024.1306.171 83 11/1/2024
2024.1306.117 82 11/1/2024
2024.1305.506 80 10/31/2024
2024.1305.502 90 10/31/2024
2024.1305.465 85 10/31/2024
2024.1305.442 79 10/31/2024
2024.1305.399 87 10/31/2024
2024.1299.1070 79 10/25/2024
2024.1289.621 88 10/15/2024
2024.1289.338 88 10/15/2024
2024.1277.836 93 10/5/2024
2024.1277.711 87 10/3/2024
2024.1277.695 88 10/3/2024
2024.1270.409 96 9/26/2024
2024.1269.621 112 9/25/2024
2024.1269.619 96 9/25/2024
2024.1269.605 100 9/25/2024
2024.1242.282 109 8/29/2024
2024.1242.261 90 8/29/2024
2024.1242.233 110 8/29/2024
2024.1238.829 109 8/25/2024
2024.1238.327 126 8/25/2024
2024.1225.297 121 8/12/2024
2024.1205.140 77 7/23/2024
2024.1204.110 112 7/22/2024
2024.1204.62 76 7/22/2024
2024.1190.491 109 7/8/2024
2024.1177.305 114 6/25/2024
2024.1168.700 92 6/16/2024
2024.1168.649 107 6/16/2024
2024.1168.535 96 6/16/2024
2024.1167.643 101 6/15/2024
2024.1166.989 114 6/14/2024
2024.1166.818 86 6/14/2024
2024.1166.535 91 6/14/2024
2024.1166.422 107 6/14/2024
2024.1166.362 93 6/14/2024
2024.1166.360 93 6/14/2024
2024.1165.1212 98 6/13/2024
2024.1165.1160 86 6/13/2024
2024.1165.1019 98 6/13/2024
2024.1165.978 107 6/13/2024
2024.1165.920 101 6/13/2024
2024.1165.908 87 6/13/2024
2024.1165.873 86 6/13/2024
2024.1165.830 111 6/13/2024
2024.1165.806 110 6/13/2024
2024.1165.794 89 6/13/2024
2024.1165.792 103 6/13/2024
2024.1165.761 102 6/13/2024
2024.1165.743 103 6/13/2024
2024.1165.735 87 6/13/2024
2024.1165.713 111 6/13/2024
2024.1165.640 92 6/13/2024
2024.1165.574 105 6/13/2024
2024.1165.466 101 6/13/2024
2024.1165.417 117 6/13/2024
2024.1165.392 105 6/13/2024
2024.1164.341 81 6/12/2024
2024.1155.941 114 6/3/2024
2024.1140.783 114 5/19/2024
2024.1140.692 110 5/19/2024
2024.1140.673 93 5/19/2024
2024.1129.506 115 5/8/2024
2024.1128.831 133 5/7/2024
2024.1124.465 87 5/3/2024
2024.1123.1162 80 5/2/2024
2024.1123.1117 65 5/2/2024
2024.1123.1050 72 5/2/2024
2024.1122.352 113 5/1/2024
2024.1122.233 100 5/1/2024
2024.1115.1101 123 4/24/2024
2024.1115.1048 97 4/24/2024
2024.1115.932 103 4/24/2024
2024.1115.858 93 4/24/2024
2024.1115.665 104 4/24/2024
2024.1115.648 121 4/24/2024
2024.1115.591 95 4/24/2024
2024.1101.390 100 4/10/2024
2024.1100.741 117 4/9/2024
2024.1099.526 98 4/8/2024
2024.1099.466 103 4/8/2024
2024.1098.573 122 4/7/2024
2024.1095.977 100 4/4/2024
2024.1095.847 97 4/4/2024
2024.1095.604 104 4/4/2024
2024.1095.485 118 4/4/2024
2024.1094.930 97 4/3/2024
2024.1094.910 114 4/3/2024
2024.1094.387 113 4/3/2024
2024.1094.313 113 4/3/2024
2024.1093.520 112 4/2/2024
2024.1092.240 106 4/1/2024
2024.1089.1425 118 3/29/2024
2024.1089.983 104 3/29/2024
2024.1089.942 97 3/29/2024
2024.1089.2 100 3/29/2024
2024.1088.1343 125 3/28/2024
2024.1088.1139 117 3/28/2024
2024.1088.875 112 3/28/2024
2024.1088.700 132 3/28/2024
2024.1088.603 121 3/28/2024
2024.1088.590 92 3/28/2024
2024.1088.575 123 3/28/2024
2024.1088.561 125 3/28/2024
2024.1088.506 102 3/28/2024
2024.1088.18 103 3/28/2024
2024.1087.1181 134 3/27/2024
2024.1087.1173 102 3/27/2024
2024.1087.1143 122 3/27/2024
2024.1087.1108 108 3/27/2024
2024.1087.950 139 3/27/2024
2024.1087.939 113 3/27/2024
2024.1087.252 115 3/27/2024
2024.1070.736 135 3/10/2024
2024.1049.1437 142 2/19/2024
2024.1036.571 133 2/5/2024
2024.1036.508 95 2/5/2024
2024.1032.1204 108 2/1/2024
2024.1032.1133 97 2/1/2024
2024.1032.1122 112 2/1/2024
2024.1032.1071 93 2/1/2024
2024.1032.940 114 2/1/2024
2024.1031.912 111 1/31/2024
2024.1031.893 93 1/31/2024
2024.1031.851 112 1/31/2024
2024.1031.829 107 1/31/2024
2024.1031.386 122 1/31/2024
2024.1031.318 117 1/31/2024
2024.1017.460 125 1/17/2024
2024.1017.420 111 1/17/2024
2024.1017.163 113 1/17/2024
2024.1016.414 307 1/16/2024
2024.1012.167 132 1/12/2024
2024.1011.406 115 1/11/2024
2024.1010.315 122 1/10/2024
2023.1358.326 153 12/24/2023
2023.1351.473 141 12/17/2023
2023.1351.445 112 12/17/2023
2023.1351.432 125 12/17/2023
2023.1350.478 114 12/16/2023
2023.1344.600 122 12/10/2023
2023.1344.529 132 12/10/2023
2023.1339.582 160 12/5/2023
2023.1338.1072 132 12/4/2023
2023.1336.844 135 12/2/2023
2023.1335.378 141 12/1/2023
2023.1335.236 138 12/1/2023
2023.1335.203 134 12/1/2023
2023.1334.814 128 11/30/2023
2023.1332.652 124 11/28/2023
2023.1332.622 137 11/28/2023
2023.1332.524 154 11/28/2023
2023.1331.1073 109 11/27/2023
2023.1331.423 124 11/27/2023
2023.1328.513 135 11/24/2023
2023.1327.985 143 11/23/2023
2023.1325.593 135 11/21/2023
2023.1325.551 138 11/21/2023
2023.1325.529 128 11/21/2023