MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / quoteForCmd

Function quoteForCmd

scripts/add-lang/verify-extraction.mjs:49–52  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

47// token nor expands a %NAME% inside it. A Windows path can't contain a double
48// quote, so a token with one is refused rather than mangled.
49function quoteForCmd(token) {
50 if (/["\r\n]/.test(token)) throw new Error(`cannot pass ${JSON.stringify(token)} through cmd.exe`);
51 return `"${token.replace(/(\\+)$/, '$1$1')}"`.replace(/[()[\]%!^"`<>&|;, *?]/g, '^$&');
52}
53
54function runCodegraph(args) {
55 const options = { encoding: 'utf8' };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected