@visulima/cerebro
Version:
A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.
26 lines (25 loc) • 1.22 kB
TypeScript
/**
* Parses nested command paths from argv.
* Supports both flat commands (e.g., "build") and nested commands (e.g., "deploy staging").
* @param availableCommands Map of all available commands keyed by their full path string
* @param argv Command line arguments to parse
* @returns Object with the matched command path and remaining argv
*/
export declare const parseNestedCommand: (availableCommands: Map<string, string[]>, argv: string[]) => {
argv: string[];
commandPath: string[] | undefined;
};
/**
* Generates a lookup key from a command path array.
* @param commandPath Array of command path segments
* @returns The command path key string
*/
export declare const getCommandPathKey: (commandPath: string[]) => string;
/**
* Generates the full command path for a command, including its commandPath if present.
* Combines the command name with any parent path segments.
* @param commandName The name of the command to add to the path
* @param commandPath Optional path segments from the command definition
* @returns The full command path array combining commandPath and commandName
*/
export declare const getFullCommandPath: (commandName: string, commandPath?: string[]) => string[];