MCPcopy Create free account
hub / github.com/cloudflare/computer / shellQuote

Function shellQuote

packages/computer/src/sh.ts:51–54  ·  view source on GitHub ↗
(arg: string)

Source from the content-addressed store, hash-verified

49// for readability; everything else is wrapped in single quotes with
50// embedded single quotes escaped as `'\''`.
51export function shellQuote(arg: string): string {
52 if (arg.length > 0 && /^[A-Za-z0-9_\-+=:,./@%]+$/.test(arg)) return arg;
53 return `'${arg.replace(/'/g, "'\\''")}'`;
54}
55
56function interpolate(value: ShellValue): string {
57 if (isRaw(value)) return value.raw;

Callers 2

sh.test.tsFile · 0.70
interpolateFunction · 0.70

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected