UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

49 lines (48 loc) 1.49 kB
import { SpawnOptions } from 'child_process'; import { Writable } from 'stream'; export default class CommandServiceImpl implements CommandService { private cwd; private activeChildProcess; private ignoreCloseErrors; private static fakeResponses; private static commandsRunCapturedByMockResponses; constructor(cwd: string); getCwd(): string; setCwd(cwd: string): void; 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; }>; getCwd(): string; setCwd(cwd: string): void; 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 {};