Files
recap/node_modules/@start9labs/start-sdk/base/lib/util/splitCommand.d.ts
T

17 lines
617 B
TypeScript

import { AllowReadonly } from '../types';
/**
* Normalizes a command into an argv-style string array.
* If given a string, wraps it as `["sh", "-c", command]`.
* If given a tuple, returns it as-is.
*
* @param command - A shell command string or a pre-split argv tuple
* @returns An argv-style string array suitable for process execution
*
* @example
* ```ts
* splitCommand("echo hello") // ["sh", "-c", "echo hello"]
* splitCommand(["node", "index.js"]) // ["node", "index.js"]
* ```
*/
export declare const splitCommand: (command: string | AllowReadonly<[string, ...string[]]>) => string[];