UNPKG

execli

Version:

Generate task-oriented CLIs declaratively

30 lines 1.43 kB
import { ExecaChildProcess, ExecaError, ExecaReturnValue, Options } from "execa"; import { InternalContext, SharedContext } from "./context.js"; export type Command = readonly string[]; export type Line = string; export type OutputLine = (line: Line) => void; type SubprocessOptions = Options & Readonly<{ /** Does not pipe the IO even when `concurrency` is 0 and does not output a line for the running command in the corresponding task. */ silent?: true; }>; export declare class ExecError extends Error { static fromExecaError({ shortMessage: error, stderr, stdout }: ExecaError): ExecError; readonly error: string; readonly stderr: string; readonly stdout: string; constructor({ error, stderr, stdout, }: Readonly<{ error: string; exitCode?: number; stderr: string; stdout: string; }>); toDetailedError({ withOutputs }: Readonly<{ withOutputs: boolean; }>): Error; } export declare const createSubprocess: (command: Command, context: SharedContext, options?: SubprocessOptions) => ExecaChildProcess; export declare const getCommandString: (command: Command, context: InternalContext, options?: Options) => string; export type Exec = (command: Command, options?: SubprocessOptions) => Promise<ExecaReturnValue>; export declare const createExec: (context: InternalContext, outputLine: OutputLine) => Exec; export {}; //# sourceMappingURL=exec.d.ts.map