export interface SpawnResult { stdout: string; stderr: string; exitCode: number; } export interface SpawnOptions { /** Written to the process and closed; without it the process reads nothing. */ stdin?: ArrayBuffer | Uint8Array | string | undefined; /** Kills the process past this deadline, which then counts as a failed exit. */ timeout?: number | undefined; /** Working directory. Defaults to the current one. */ cwd?: string | undefined; /** The whole environment the process sees. Defaults to `process.env`; spread it to add to it. */ env?: Record | undefined; /** Kills the process when aborted, rejecting with the signal's reason. */ signal?: AbortSignal | undefined; } export interface SpawnTextOptions extends SpawnOptions { /** Trims stdout. Defaults to true. */ trim?: boolean; } /** Runs `argv` and resolves with stdout, trimmed unless `trim: false`. Throws on non-zero exit, stderr in the message. */ export declare function spawnText(argv: string[], { trim, ...opts }?: SpawnTextOptions): Promise; /** Runs `argv` and resolves with raw stdout bytes. Throws on non-zero exit, stderr in the message. */ export declare function spawnBytes(argv: string[], opts?: SpawnOptions): Promise; /** Runs `argv` and resolves with the exit code; throws only when `signal` aborts it. */ export declare function spawnExit(argv: string[], opts?: SpawnOptions): Promise; type NumberOptionType = 'number' | 'int' | 'float'; type StringOptionType = 'string' | 'date' | 'path'; type OptionType = 'boolean' | StringOptionType | NumberOptionType; type AlphabetChar = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z'; type OptionValueType = T extends 'boolean' ? boolean : T extends NumberOptionType ? number : T extends 'date' ? Date : string; interface BaseOptionDefinition { alias?: string | string[]; short?: AlphabetChar; required?: boolean; description?: string; default?: FormatType; rawDefault?: string; example?: string | string[]; validate?: (value: FormatType) => true | string; } interface TypedOptionDefinition extends BaseOptionDefinition { type: T; format?: (value: string) => FormatType; } interface FormatOnlyOptionDefinition extends BaseOptionDefinition { type?: never; format: (value: string) => FormatType; } type OptionDefinition = TypedOptionDefinition<'boolean', boolean> | TypedOptionDefinition<'string' | 'path' | 'date', string> | TypedOptionDefinition | FormatOnlyOptionDefinition; type ParseArgsConfig> = T; type ParsedValues> = { [K in keyof T]: T[K]['required'] extends true ? T[K]['format'] extends (value: string) => infer R ? R : T[K]['type'] extends OptionType ? OptionValueType : never : T[K]['default'] extends NonNullable ? T[K]['format'] extends (value: string) => infer R ? R : T[K]['type'] extends OptionType ? OptionValueType : never : T[K]['format'] extends (value: string) => infer R ? R | undefined : T[K]['type'] extends OptionType ? OptionValueType | undefined : never; }; interface ArgsHelpConfig { name?: string; shortDescription?: string; usage?: string | string[]; keywords?: string[]; description?: string; footerBlocks?: { title: string; content: string | string[]; }[]; } interface ArgsConfig> { args: string[]; help?: ArgsHelpConfig; options: ParseArgsConfig; } export declare function parseArgs>(config: ArgsConfig): ParsedValues; export {}; //# sourceMappingURL=cli.d.ts.map