Console Commands
Adds attribute-discovered console commands for dependency-injected .NET applications. The package registers a command handler, scans assemblies for command classes, maps command names and aliases, converts string input into ExecuteAsync parameters, and invokes the command from a console input loop.
Use this package when a hosted console application needs command-style interactions without hand-writing a parser and dispatcher. Commands are normal DI-created classes, so they can use logging and application services through constructors.
Categories
- Attributes — class metadata used for command names, aliases, descriptions, and examples.
- Classes — command base types, the runtime handler, metadata values, and console helper utilities.
- Extensions — startup extension methods for registering the handler and command classes.
Quick Example
csharp
using AlmightyShogun.ConsoleCommands;
builder.Services
.AddConsoleCommands()
.RegisterConsoleCommands(typeof(Program).Assembly);