Redpoint.CommandLine 2024.1305.506

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

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

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.  net9.0 was computed.  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.1045.285 35 2/14/2025
2025.1043.288 65 2/12/2025
2025.1043.246 60 2/12/2025
2025.1043.197 61 2/12/2025
2025.1043.180 54 2/12/2025
2025.1043.108 61 2/12/2025
2025.1043.38 59 2/12/2025
2025.1043.27 72 2/12/2025
2025.1042.725 57 2/11/2025
2025.1042.690 59 2/11/2025
2025.1042.688 61 2/11/2025
2025.1042.418 63 2/11/2025
2025.1042.215 52 2/11/2025
2025.1042.203 70 2/11/2025
2025.1042.184 65 2/11/2025
2025.1042.142 61 2/11/2025
2025.1042.127 59 2/11/2025
2025.1037.1327 48 2/6/2025
2025.1036.280 75 2/5/2025
2025.1036.55 69 2/5/2025
2025.1035.1387 82 2/4/2025
2025.1031.111 75 1/31/2025
2025.1030.916 75 1/30/2025
2025.1030.895 67 1/30/2025
2025.1030.592 73 1/30/2025
2025.1029.664 19 1/29/2025
2025.1029.632 20 1/29/2025
2025.1029.596 22 1/29/2025
2025.1028.386 40 1/28/2025
2025.1025.723 34 1/25/2025
2025.1025.712 35 1/25/2025
2025.1019.913 71 1/19/2025
2025.1018.374 70 1/18/2025
2025.1018.285 62 1/18/2025
2025.1017.646 69 1/17/2025
2025.1017.379 78 1/17/2025
2025.1016.1370 72 1/16/2025
2025.1016.765 73 1/16/2025
2025.1016.712 75 1/16/2025
2025.1016.550 68 1/16/2025
2025.1016.541 70 1/16/2025
2025.1016.532 74 1/16/2025
2025.1016.325 61 1/16/2025
2025.1016.308 67 1/16/2025
2025.1016.296 63 1/16/2025
2025.1016.237 71 1/16/2025
2025.1016.184 69 1/16/2025
2025.1016.70 69 1/16/2025
2025.1016.6 69 1/16/2025
2025.1015.1438 68 1/16/2025
2025.1015.1437 66 1/16/2025
2025.1015.1411 66 1/15/2025
2025.1015.240 50 1/15/2025
2025.1015.223 47 1/15/2025
2025.1015.183 48 1/15/2025
2025.1014.1342 38 1/14/2025
2025.1014.273 52 1/14/2025
2025.1014.256 55 1/14/2025
2025.1012.440 71 1/12/2025
2025.1012.327 65 1/12/2025
2025.1012.279 65 1/12/2025
2025.1002.636 89 1/2/2025
2025.1001.1435 85 1/2/2025
2025.1001.1397 84 1/1/2025
2025.1001.770 94 1/1/2025
2025.1001.570 96 1/1/2025
2025.1001.558 87 1/1/2025
2025.1001.421 96 1/1/2025
2025.1001.390 89 1/1/2025
2025.1001.234 101 1/1/2025
2025.1001.123 91 1/1/2025
2024.1360.354 79 12/25/2024
2024.1360.60 82 12/25/2024
2024.1360.32 84 12/25/2024
2024.1358.450 91 12/23/2024
2024.1358.359 83 12/23/2024
2024.1358.312 88 12/23/2024
2024.1358.244 84 12/23/2024
2024.1358.120 92 12/23/2024
2024.1348.253 91 12/13/2024
2024.1345.1379 83 12/10/2024
2024.1345.506 86 12/10/2024
2024.1345.379 81 12/10/2024
2024.1345.145 79 12/10/2024
2024.1345.72 86 12/10/2024
2024.1345.69 77 12/10/2024
2024.1345.15 84 12/10/2024
2024.1344.1436 85 12/10/2024
2024.1344.600 94 12/9/2024
2024.1344.411 83 12/9/2024
2024.1340.379 93 12/5/2024
2024.1340.15 94 12/5/2024
2024.1338.786 89 12/3/2024
2024.1338.722 98 12/3/2024
2024.1338.697 91 12/3/2024
2024.1338.639 93 12/3/2024
2024.1338.541 92 12/3/2024
2024.1338.318 82 12/3/2024
2024.1338.298 87 12/3/2024
2024.1338.98 97 12/3/2024
2024.1337.756 92 12/2/2024
2024.1337.634 91 12/2/2024
2024.1337.625 91 12/2/2024
2024.1337.621 94 12/2/2024
2024.1337.594 88 12/2/2024
2024.1337.136 74 12/2/2024
2024.1336.793 93 12/1/2024
2024.1336.773 92 12/1/2024
2024.1336.305 90 12/1/2024
2024.1336.12 97 12/1/2024
2024.1335.1421 91 11/30/2024
2024.1335.1384 91 11/30/2024
2024.1334.1308 87 11/29/2024
2024.1334.764 91 11/29/2024
2024.1334.722 92 11/29/2024
2024.1330.185 90 11/25/2024
2024.1328.505 91 11/23/2024
2024.1328.470 92 11/23/2024
2024.1328.452 91 11/23/2024
2024.1323.910 91 11/18/2024
2024.1323.653 84 11/18/2024
2024.1323.185 95 11/18/2024
2024.1323.49 84 11/18/2024
2024.1322.714 94 11/17/2024
2024.1320.653 90 11/15/2024
2024.1320.619 82 11/15/2024
2024.1320.601 92 11/15/2024
2024.1320.159 88 11/15/2024
2024.1320.98 87 11/15/2024
2024.1320.2 86 11/15/2024
2024.1319.1431 87 11/15/2024
2024.1319.1335 86 11/14/2024
2024.1317.631 95 11/12/2024
2024.1316.330 108 11/11/2024
2024.1311.540 101 11/6/2024
2024.1306.225 93 11/1/2024
2024.1306.199 93 11/1/2024
2024.1306.171 89 11/1/2024
2024.1306.117 89 11/1/2024
2024.1305.506 85 10/31/2024
2024.1305.502 97 10/31/2024
2024.1305.465 90 10/31/2024
2024.1305.442 84 10/31/2024
2024.1305.399 94 10/31/2024
2024.1299.1070 86 10/25/2024
2024.1289.621 93 10/15/2024
2024.1289.338 91 10/15/2024
2024.1277.836 96 10/5/2024
2024.1277.711 90 10/3/2024
2024.1277.695 91 10/3/2024
2024.1270.409 101 9/26/2024
2024.1269.621 117 9/25/2024
2024.1269.619 101 9/25/2024
2024.1269.605 103 9/25/2024
2024.1242.282 110 8/29/2024
2024.1242.261 91 8/29/2024
2024.1242.233 113 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 113 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 105 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 116 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 121 6/13/2024
2024.1165.392 109 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 97 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 127 4/24/2024
2024.1115.1048 101 4/24/2024
2024.1115.932 107 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 99 4/24/2024
2024.1101.390 106 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 104 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 106 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 145 12/17/2023
2023.1351.445 116 12/17/2023
2023.1351.432 129 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 119 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