MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / buildCommand

Function buildCommand

src/audio/transcribe.ts:50–55  ·  view source on GitHub ↗
(template: string, filePath: string)

Source from the content-addressed store, hash-verified

48/** Build the local argv from a template + file path. Substitutes `{file}`; appends it when the
49 * template has no placeholder. Returns `['sh','-c', …]` so a normal command line Just Works. PURE. */
50export function buildCommand(template: string, filePath: string): string[] {
51 const line = template.includes('{file}')
52 ? template.replaceAll('{file}', shellQuote(filePath))
53 : `${template} ${shellQuote(filePath)}`;
54 return ['sh', '-c', line];
55}
56
57function shellQuote(s: string): string {
58 return `'${s.replaceAll("'", `'\\''`)}'`;

Callers 2

transcribe.test.tsFile · 0.90
runCommandFunction · 0.85

Calls 1

shellQuoteFunction · 0.70

Tested by

no test coverage detected