Redpoint.CommandLine 2025.1015.1411

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Redpoint.CommandLine --version 2025.1015.1411                
NuGet\Install-Package Redpoint.CommandLine -Version 2025.1015.1411                
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.1015.1411" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Redpoint.CommandLine --version 2025.1015.1411                
#r "nuget: Redpoint.CommandLine, 2025.1015.1411"                
#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.1015.1411

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

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 net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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.1017.646 26 1/17/2025
2025.1017.379 29 1/17/2025
2025.1016.1370 36 1/16/2025
2025.1016.765 34 1/16/2025
2025.1016.712 35 1/16/2025
2025.1016.550 33 1/16/2025
2025.1016.541 33 1/16/2025
2025.1016.532 39 1/16/2025
2025.1016.325 28 1/16/2025
2025.1016.308 34 1/16/2025
2025.1016.296 30 1/16/2025
2025.1016.237 36 1/16/2025
2025.1016.184 36 1/16/2025
2025.1016.70 35 1/16/2025
2025.1016.6 34 1/16/2025
2025.1015.1438 35 1/16/2025
2025.1015.1437 33 1/16/2025
2025.1015.1411 33 1/15/2025
2025.1015.240 35 1/15/2025
2025.1015.223 32 1/15/2025
2025.1015.183 33 1/15/2025
2025.1014.1342 34 1/14/2025
2025.1014.273 48 1/14/2025
2025.1014.256 51 1/14/2025
2025.1012.440 61 1/12/2025
2025.1012.327 55 1/12/2025
2025.1012.279 55 1/12/2025
2025.1002.636 85 1/2/2025
2025.1001.1435 81 1/2/2025
2025.1001.1397 80 1/1/2025
2025.1001.770 90 1/1/2025
2025.1001.570 92 1/1/2025
2025.1001.558 83 1/1/2025
2025.1001.421 92 1/1/2025
2025.1001.390 85 1/1/2025
2025.1001.234 97 1/1/2025
2025.1001.123 87 1/1/2025
2024.1360.354 75 12/25/2024
2024.1360.60 78 12/25/2024
2024.1360.32 80 12/25/2024
2024.1358.450 87 12/23/2024
2024.1358.359 79 12/23/2024
2024.1358.312 84 12/23/2024
2024.1358.244 80 12/23/2024
2024.1358.120 88 12/23/2024
2024.1348.253 83 12/13/2024
2024.1345.1379 79 12/10/2024
2024.1345.506 82 12/10/2024
2024.1345.379 76 12/10/2024
2024.1345.145 77 12/10/2024
2024.1345.72 82 12/10/2024
2024.1345.69 73 12/10/2024
2024.1345.15 80 12/10/2024
2024.1344.1436 81 12/10/2024
2024.1344.600 90 12/9/2024
2024.1344.411 78 12/9/2024
2024.1340.379 89 12/5/2024
2024.1340.15 90 12/5/2024
2024.1338.786 85 12/3/2024
2024.1338.722 94 12/3/2024
2024.1338.697 87 12/3/2024
2024.1338.639 89 12/3/2024
2024.1338.541 88 12/3/2024
2024.1338.318 78 12/3/2024
2024.1338.298 83 12/3/2024
2024.1338.98 93 12/3/2024
2024.1337.756 88 12/2/2024
2024.1337.634 87 12/2/2024
2024.1337.625 87 12/2/2024
2024.1337.621 90 12/2/2024
2024.1337.594 84 12/2/2024
2024.1337.136 70 12/2/2024
2024.1336.793 89 12/1/2024
2024.1336.773 88 12/1/2024
2024.1336.305 86 12/1/2024
2024.1336.12 93 12/1/2024
2024.1335.1421 87 11/30/2024
2024.1335.1384 85 11/30/2024
2024.1334.1308 83 11/29/2024
2024.1334.764 87 11/29/2024
2024.1334.722 88 11/29/2024
2024.1330.185 86 11/25/2024
2024.1328.505 87 11/23/2024
2024.1328.470 88 11/23/2024
2024.1328.452 87 11/23/2024
2024.1323.910 87 11/18/2024
2024.1323.653 80 11/18/2024
2024.1323.185 89 11/18/2024
2024.1323.49 80 11/18/2024
2024.1322.714 90 11/17/2024
2024.1320.653 86 11/15/2024
2024.1320.619 78 11/15/2024
2024.1320.601 88 11/15/2024
2024.1320.159 84 11/15/2024
2024.1320.98 81 11/15/2024
2024.1320.2 82 11/15/2024
2024.1319.1431 83 11/15/2024
2024.1319.1335 82 11/14/2024
2024.1317.631 89 11/12/2024
2024.1316.330 104 11/11/2024
2024.1311.540 97 11/6/2024
2024.1306.225 91 11/1/2024
2024.1306.199 91 11/1/2024
2024.1306.171 87 11/1/2024
2024.1306.117 85 11/1/2024
2024.1305.506 83 10/31/2024
2024.1305.502 93 10/31/2024
2024.1305.465 88 10/31/2024
2024.1305.442 82 10/31/2024
2024.1305.399 90 10/31/2024
2024.1299.1070 84 10/25/2024
2024.1289.621 91 10/15/2024
2024.1289.338 89 10/15/2024
2024.1277.836 94 10/5/2024
2024.1277.711 88 10/3/2024
2024.1277.695 89 10/3/2024
2024.1270.409 97 9/26/2024
2024.1269.621 115 9/25/2024
2024.1269.619 99 9/25/2024
2024.1269.605 101 9/25/2024
2024.1242.282 110 8/29/2024
2024.1242.261 91 8/29/2024
2024.1242.233 111 8/29/2024
2024.1238.829 110 8/25/2024
2024.1238.327 127 8/25/2024
2024.1225.297 122 8/12/2024
2024.1205.140 78 7/23/2024
2024.1204.110 113 7/22/2024
2024.1204.62 79 7/22/2024
2024.1190.491 111 7/8/2024
2024.1177.305 116 6/25/2024
2024.1168.700 96 6/16/2024
2024.1168.649 111 6/16/2024
2024.1168.535 98 6/16/2024
2024.1167.643 103 6/15/2024
2024.1166.989 116 6/14/2024
2024.1166.818 90 6/14/2024
2024.1166.535 93 6/14/2024
2024.1166.422 109 6/14/2024
2024.1166.362 95 6/14/2024
2024.1166.360 95 6/14/2024
2024.1165.1212 100 6/13/2024
2024.1165.1160 88 6/13/2024
2024.1165.1019 103 6/13/2024
2024.1165.978 109 6/13/2024
2024.1165.920 104 6/13/2024
2024.1165.908 91 6/13/2024
2024.1165.873 90 6/13/2024
2024.1165.830 113 6/13/2024
2024.1165.806 114 6/13/2024
2024.1165.794 91 6/13/2024
2024.1165.792 105 6/13/2024
2024.1165.761 104 6/13/2024
2024.1165.743 105 6/13/2024
2024.1165.735 89 6/13/2024
2024.1165.713 113 6/13/2024
2024.1165.640 94 6/13/2024
2024.1165.574 107 6/13/2024
2024.1165.466 105 6/13/2024
2024.1165.417 119 6/13/2024
2024.1165.392 107 6/13/2024
2024.1164.341 83 6/12/2024
2024.1155.941 116 6/3/2024
2024.1140.783 116 5/19/2024
2024.1140.692 112 5/19/2024
2024.1140.673 95 5/19/2024
2024.1129.506 119 5/8/2024
2024.1128.831 135 5/7/2024
2024.1124.465 89 5/3/2024
2024.1123.1162 82 5/2/2024
2024.1123.1117 67 5/2/2024
2024.1123.1050 76 5/2/2024
2024.1122.352 117 5/1/2024
2024.1122.233 102 5/1/2024
2024.1115.1101 125 4/24/2024
2024.1115.1048 101 4/24/2024
2024.1115.932 105 4/24/2024
2024.1115.858 97 4/24/2024
2024.1115.665 106 4/24/2024
2024.1115.648 125 4/24/2024
2024.1115.591 97 4/24/2024
2024.1101.390 104 4/10/2024
2024.1100.741 123 4/9/2024
2024.1099.526 102 4/8/2024
2024.1099.466 107 4/8/2024
2024.1098.573 124 4/7/2024
2024.1095.977 104 4/4/2024
2024.1095.847 99 4/4/2024
2024.1095.604 106 4/4/2024
2024.1095.485 120 4/4/2024
2024.1094.930 101 4/3/2024
2024.1094.910 117 4/3/2024
2024.1094.387 117 4/3/2024
2024.1094.313 117 4/3/2024
2024.1093.520 114 4/2/2024
2024.1092.240 108 4/1/2024
2024.1089.1425 120 3/29/2024
2024.1089.983 106 3/29/2024
2024.1089.942 99 3/29/2024
2024.1089.2 102 3/29/2024
2024.1088.1343 129 3/28/2024
2024.1088.1139 121 3/28/2024
2024.1088.875 116 3/28/2024
2024.1088.700 134 3/28/2024
2024.1088.603 123 3/28/2024
2024.1088.590 94 3/28/2024
2024.1088.575 125 3/28/2024
2024.1088.561 127 3/28/2024
2024.1088.506 104 3/28/2024
2024.1088.18 105 3/28/2024
2024.1087.1181 136 3/27/2024
2024.1087.1173 104 3/27/2024
2024.1087.1143 124 3/27/2024
2024.1087.1108 110 3/27/2024
2024.1087.950 141 3/27/2024
2024.1087.939 115 3/27/2024
2024.1087.252 117 3/27/2024
2024.1070.736 137 3/10/2024
2024.1049.1437 144 2/19/2024
2024.1036.571 135 2/5/2024
2024.1036.508 99 2/5/2024
2024.1032.1204 110 2/1/2024
2024.1032.1133 99 2/1/2024
2024.1032.1122 114 2/1/2024
2024.1032.1071 95 2/1/2024
2024.1032.940 116 2/1/2024
2024.1031.912 113 1/31/2024
2024.1031.893 95 1/31/2024
2024.1031.851 114 1/31/2024
2024.1031.829 109 1/31/2024
2024.1031.386 124 1/31/2024
2024.1031.318 119 1/31/2024
2024.1017.460 127 1/17/2024
2024.1017.420 113 1/17/2024
2024.1017.163 115 1/17/2024
2024.1016.414 318 1/16/2024
2024.1012.167 134 1/12/2024
2024.1011.406 117 1/11/2024
2024.1010.315 124 1/10/2024
2023.1358.326 155 12/24/2023
2023.1351.473 143 12/17/2023
2023.1351.445 114 12/17/2023
2023.1351.432 127 12/17/2023
2023.1350.478 116 12/16/2023
2023.1344.600 124 12/10/2023
2023.1344.529 134 12/10/2023
2023.1339.582 162 12/5/2023
2023.1338.1072 134 12/4/2023
2023.1336.844 137 12/2/2023
2023.1335.378 143 12/1/2023
2023.1335.236 140 12/1/2023
2023.1335.203 136 12/1/2023
2023.1334.814 130 11/30/2023
2023.1332.652 126 11/28/2023
2023.1332.622 139 11/28/2023
2023.1332.524 156 11/28/2023
2023.1331.1073 117 11/27/2023
2023.1331.423 126 11/27/2023
2023.1328.513 137 11/24/2023
2023.1327.985 145 11/23/2023
2023.1325.593 137 11/21/2023
2023.1325.551 140 11/21/2023
2023.1325.529 130 11/21/2023