import { CCliRoot } from './c-cli-tree'; import { CCliProcess } from './c-cli-process'; import { CCliColor } from './c-cli-color'; import { CCliLogger } from './c-cli-logger'; /** Options for creating a {@link CCli} */ export declare type CCliOptions = { /** Enable/disable ANSI text color decoration * @default process.stdout.isTTY && process.stderr.isTTY */ ansi?: boolean; /** Text coloring methods. Takes precedence over the `ansi` option if * provided. If not provided, a {@link CCliColor} instance will be created * using {@link cCliColorFactory} with the {@link CCliOptions.ansi} option */ color?: CCliColor; /** Number of terminal columns * @default process.stdout.columns || 100 */ columns?: number; /** Called after the command has completed. Defaults to `process.exit` */ done?: CCliProcess['exit']; /** `CliLogger` object to use for the CLI. Defaults to the global `console` * object. The CLI runner calls `logger.log` on the command's `action` return * value if there is one. The CLI runner calls `logger.error` on the * exception if one is thrown. The `logger` is injected into the command * `action` too. */ logger?: CCliLogger; }; /** A **@carnesen/cli** command-line interface (CLI) */ export declare class CCli { private readonly root; private readonly options; private readonly color; private readonly logger; protected constructor(root: CCliRoot, options: CCliOptions); /** Programmatic interface for the CLI. Mostly used for unit testing * @param args Command-line argument strings * @returns A promise resolving to the command action's return value */ api(args: string[]): Promise; /** Run the command-line interface, console.log the result, and * `process.exit` * @param args Command-line arguments to be parsed and passed into the * command action. Defaults to `process.argv.slice(2)` in Node.js. * @returns A promise resolving to the command's exit code */ run(args?: string[]): Promise; /** Split a command line into args and call this `Cli`'s `run` method * * This method is used to implement the pseudo-shell on the * [**@carnesen/cli** website](https://cli.carnesen.com/) and will form the * basis of a [future REPL * feature](https://github.com/carnesen/cli/issues/73) * @param line A command line * @returns A promise resolving to the command's exit code */ runLine(line?: string): Promise; private done; private handleException; /** Factory for {@link CCli}s * @param root The "root" of this CLI's command tree. See also * {@link CCliCommandGroup}. * @param options Advanced options for configuring the CLI */ static create(root: CCliRoot, options?: CCliOptions): CCli; } //# sourceMappingURL=c-cli.d.ts.map