UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

45 lines (44 loc) 1.38 kB
import { SpawnOptions } from 'child_process'; import { Writable } from 'stream'; export default class CommandServiceImpl implements CommandService { cwd: string; private activeChildProcess; private ignoreCloseErrors; private static fakeResponses; private static commandsRunCapturedByMockResponses; constructor(cwd: string); execute(cmd: string, options?: ExecuteCommandOptions): Promise<{ stdout: string; }>; kill: () => void; pid: () => number | undefined; private getMockResponse; static fakeCommand(command: string | RegExp, response: FakedCommandResponse): void; static clearFakedResponses(): void; } export type FakedCommandCallback = (executable: string, args: any[]) => void; interface FakedCommandResponse { code: number; stdout?: string; stderr?: string; callback?: FakedCommandCallback; } export interface CommandService { execute(cmd: string, options?: ExecuteCommandOptions): Promise<{ stdout: string; }>; kill(): void; pid(): number | undefined; } export interface ExecuteCommandOptions { ignoreErrors?: boolean; args?: string[]; shouldStream?: boolean; outStream?: Writable; onError?: (error: string) => void; onData?: (data: string) => void; spawnOptions?: SpawnOptions; forceColor?: boolean; env?: Record<string, any>; } export {};