Namespace Albatross.CommandLine
Classes
- AsyncOptionAction
An asynchronous command line action that wraps a custom async handler function. This action is non-terminating, allowing subsequent actions to execute.
- BaseHandler<T>
Abstract base class for command handlers that provides common functionality for processing parsed command parameters. Inherit from this class to implement custom command handlers with strongly-typed parameter access.
- CommandBuilder
Builds and manages a hierarchical command structure for command-line interfaces. Commands are organized by space-separated keys (e.g., "parent child") that define the hierarchy.
- CommandContext
Default implementation of ICommandContext that provides state sharing between option handlers and command handlers.
- CommandHost
Host for running commands
await using var host = new CommandHost("Sample Command Line Application") .RegisterServices((result, config, services) => {...}) .AddCommands() .Parse(args) .ConfigureHost((result, builder) => {...}) .Build(); return await host.InvokeAsync();
- DefaultAsyncCommandHandler<T>
A default command handler that outputs diagnostic information about the command invocation. Useful for testing and debugging command configurations.
- Extensions
Extension methods for command-line configuration and command hierarchy management.
- OptionHandlerResult<T>
Wraps the result of an option handler that may or may not produce a value.
- OptionHandlerStatus
Records the execution status of an option handler, including success/failure and any error information.
- SyncOptionAction
A synchronous command line action that wraps a custom sync handler function. This action is non-terminating, allowing subsequent actions to execute.
- VerbosityOption
A command-line option for controlling logging verbosity level. Supports case-insensitive prefix matching (e.g., "v" matches "Verbose", "d" matches "Debug").
Interfaces
- IAsyncOptionHandler<T>
Handler for processing command options or arguments as pre-actions before the main command handler executes. Use this interface for handlers that perform side effects without returning a value.
- IAsyncOptionHandler<TOption, TContextValue>
Handler for processing command options that returns a value to be stored in the command context. The returned value is automatically stored and can be retrieved by subsequent handlers or the command handler.
- ICommandContext
This interface is a command context with scoped lifetime. The same instance of the context can be injected to PreAction handlers as well as the Command handler. It can be used to share state between those handlers.