//#region command.d.ts /** * Command is a string array, like ['git', 'commit', '-m', '"Initial commit"'] */ type Command = string[]; type RunOptions = { startText?: string; doneText?: string | ((output: string) => string); silent?: boolean; captureOutput?: boolean; useSpinner?: boolean; env?: NodeJS.ProcessEnv; cwd?: string; /** If defined this function is called to all you to transform the output from the command into a new string. */ transformOutput?: (output: string) => string; }; /** * An awaitable wrapper around `spawn` that optionally displays progress to user and processes/captures the command's output * * @param command - The command to run as an array of strings * @param opts.silent - Should the command's stdout and stderr be dispalyed to the user * @param opts.captureOutput - Should the output of the command the returned as a string. * @param opts.env - An object of environment variables to be injected when running the command * @param opts.cwd - The directory in which the command should be run * @param opts.useSpinner - Should a spinner be shown when running the command * @param opts.startText - Spinner start text * @param opts.endText - Spinner end text * @param opts.transformOutput - A transformer to be run on command output before returning * * @returns Output collected from the stdout of the command, if `captureOutput` was set to true. Otherwise `null`. */ declare const runCommand: (command: Command, opts?: RunOptions) => Promise; /** * Formats an array of command line arguments to be displayed to the user * in a platform safe way. Args used in conjunction with `runCommand` are safe * since we use `cross-spawn` to handle multi-platform support. * * However, when we output commands to the user, we have to make sure that they * are compatible with the platform they are using. * * @param args - The arguments to format to the user */ declare function quoteShellArgs(args: string[]): string; //#endregion export { RunOptions, quoteShellArgs, runCommand };