askeroo
Version:
A modern CLI prompt library with flow control, history navigation, and conditional prompts
30 lines • 1.08 kB
TypeScript
import { EventEmitter } from "events";
/**
* Enhanced spawn result that preserves ANSI colors from commands
*/
export interface ColoredSpawnResult extends EventEmitter {
stdout: NodeJS.ReadableStream;
stderr: NodeJS.ReadableStream;
pid?: number;
}
/**
* Spawn a command with automatic color preservation
*
* This function automatically enables ANSI colors in command output by:
* 1. Using node-pty if available (creates real pseudo-TTY)
* 2. Falling back to environment variables (FORCE_COLOR, etc.)
*
* @param command - Command to run
* @param args - Command arguments
* @param options - Additional spawn options
* @returns EventEmitter with stdout, stderr streams and events
*
* @example
* ```typescript
* const git = spawnWithColors("git", ["status"]);
* git.stdout.on("data", (data) => output.write(data.toString()));
* git.on("close", (code) => console.log("Exit code:", code));
* ```
*/
export declare function spawnWithColors(command: string, args?: string[], options?: any): ColoredSpawnResult;
//# sourceMappingURL=spawn-with-colors.d.ts.map