import type { CommandBuilder } from './core/index.js'; import { Option } from './options/base.js'; import { Command, type CommandClass, type Definition } from './command.js'; export type ProcessOptions = { input: string[]; /** * @deprecated Experimental setting, exact behavior may change */ partial?: boolean; }; export type ProgramOptions = { /** * The label of the binary. * * Shown at the top of the usage information. */ binaryLabel?: string; /** * The name of the binary. * * Included in the path and the examples of the definitions. */ binaryName: string; /** * The version of the binary. * * Shown at the top of the usage information. */ binaryVersion?: string; }; export type MiniProgram = ProgramOptions & { /** * Returns an Array representing the definitions of all registered commands. */ definitions(): Definition[]; /** * Get the definition of a particular command. */ definition(command: CommandClass): Definition | null; /** * Compiles a command and its arguments using the `CommandBuilder`. * * @param input An array containing the name of the command and its arguments * * @returns The compiled `Command`, with its properties populated with the arguments. */ process(input: string[]): Command; /** * Formats errors using colors. * * @param error The error to format. If `error.name` is `'Error'`, it is replaced with `'Internal Error'`. * @param opts.command The command whose usage will be included in the formatted error. */ error(error: Error, opts?: { command?: Command | null; }): string; /** * Returns the usage of a command. * * @param command The `Command` whose usage will be returned or `null` to return the usage of all commands. * @param opts.detailed If `true`, the usage of a command will also include its description, details, and examples. Doesn't have any effect if `command` is `null` or doesn't have a `usage` property. * @param opts.prefix The prefix displayed before each command. Defaults to `$`. */ usage(command?: CommandClass | Command | null, opts?: { detailed?: boolean; prefix?: string; }): string; }; export declare class Program { private readonly builder; protected readonly registrations: Map; specs: Map>; }>; readonly binaryLabel?: string; readonly binaryName: string; readonly binaryVersion?: string; constructor({ binaryLabel, binaryName: binaryNameOpt, binaryVersion }: ProgramOptions); register(commandClass: CommandClass): void; process(opts: ProcessOptions): Command; process(input: string[]): Command; process(input: string[]): Command; run(input: Command | string[]): Promise; run(input: Command | string[]): Promise; definition(commandClass: CommandClass): Definition | null; definitions(): Definition[]; usage(command?: CommandClass | Command | null, { detailed, prefix }?: { detailed?: boolean; prefix?: string; }): string; error(error: Error | any, { command, }?: { command?: Command | null; }): string; protected getUsageByRegistration(klass: CommandClass, opts?: { detailed?: boolean; inlineOptions?: boolean; }): ReturnType['usage']>; protected getUsageByIndex(n: number, opts?: { detailed?: boolean; inlineOptions?: boolean; }): ReturnType['usage']>; }