export interface NamedCommandInvocation { readonly command: string; } export type CommandParseResult = { readonly ok: true; readonly command: TInvocation; } | { readonly ok: false; readonly errors: readonly string[]; }; export type CommandExecutionResult = { readonly ok: true; readonly command: TInvocation; } | { readonly ok: false; readonly errors: readonly string[]; }; export type CommandOptionParseResult = { readonly ok: true; readonly value: TValue; } | { readonly ok: false; readonly error: string; }; export interface CommandOption { readonly name: `--${string}`; parse(value: string): CommandOptionParseResult; } export declare function valueOption(name: `--${string}`, parse: (value: string) => CommandOptionParseResult): CommandOption; export declare function stringOption(name: `--${string}`): CommandOption; export interface ParsedCommandInput { readonly remainingArgs: readonly string[]; value(option: CommandOption): TValue | undefined; values(option: CommandOption): readonly TValue[]; } export type CommandBuildResult = { readonly ok: true; readonly command: TInvocation; } | { readonly ok: false; readonly errors: readonly string[]; }; type CommandBuilder = (input: ParsedCommandInput) => CommandBuildResult; type CommandAction = (command: TInvocation, context: TContext) => void | Promise; export declare class Command { readonly name: string; private readonly options; private readonly subcommands; private builder?; private commandAction?; constructor(name: string); option(option: CommandOption): this; build(builder: CommandBuilder): this; action(action: CommandAction): this; command(command: Command): Command; parse(argv: readonly string[]): CommandParseResult; execute(argv: readonly string[], context: TContext): Promise>; private select; private parseOwn; private parseOptions; } export {}; //# sourceMappingURL=command.d.ts.map