Skip to content

Installation ​

Install AlmightyShogun.ConsoleCommands in the .NET console or hosted application that should discover and run command classes from dependency injection. The package targets net10.0 and expects command implementations to be registered from one or more assemblies.

sh
dotnet add package AlmightyShogun.ConsoleCommands

Dependencies ​

Package references ​

  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.11 — the service collection the commands register into.
  • Microsoft.Extensions.Logging.Abstractions 10.0.11 — ILogger<T>, which the input loop reports unusable input through. Output goes to whichever logging provider the application registered.

Project references ​

  • AlmightyShogun.Utils — provides assembly scanning and inherited-type registration helpers.

Startup Registration ​

AddConsoleCommands registers the input loop, and RegisterConsoleCommands discovers the command classes it dispatches to. Nothing reads the console until IConsoleCommandHandler is resolved and started.

csharp
using AlmightyShogun.ConsoleCommands;

builder.Services
    .AddConsoleCommands()
    .RegisterConsoleCommands();

All packages are released under the MIT License.