export * from "./cmds-command.dist"; export { default as Command } from "./cmds-command.dist"; export * from "./cmds-step.dist"; export { default as Step } from "./cmds-step.dist"; import Command from "./cmds-command.dist"; import type { StepFn } from "./cmds-step.dist"; import { Logged } from '@hackbg/logs'; export type CommandTree = Record | CommandContext>; export default class CommandContext extends Logged { /** Name of this command tree. */ name: string; /** Description of this command tree. */ info: string; /** Start of command execution. */ timestamp: string; /** Process environment at lauch of process. */ env: Record; /** Current working directory at launch of process. */ cwd: string; /** All registered commands. */ commandTree: CommandTree; /** Currently executing command. */ currentCommand: string; /** Extra arguments passed from the command line. */ args: string[]; constructor(options?: Partial<{ name: string; info: string; }>); /** Define a command and return it. */ command>(parameters: { name: string; args: string; info: string; }, step: X): X; /** Define a command and return `this`. */ addCommand>(parameters: { name: string; args: string; info: string; }, step: X): this; /** Attach a command subtree and return it. */ commands(name: string, info: string, subtree: C): C; /** Attach a command subtree and return this. */ addCommands(name: string, info: string, subtree: CommandContext): this; /** Filter commands by each word from the list of arguments * then pass the rest as arguments to the found command. */ parse(args: string[]): [Command | CommandContext | null, ...string[]]; /** Run a command from this command tree. */ run(argv: string[], context?: any): Promise; printUsageNoCommand(arg0: this): Promise; printUsageMissingCommand(arg0: Parameters[0]): Promise; printUsage({ constructor: { name }, commandTree }: CommandContext): Promise; } export declare function parseCommandLine(commandTree: CommandTree, commandLine: string[]): [Command | CommandContext | null, ...string[]]; //# sourceMappingURL=cmds.browser.d.ts.map