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

Function expandShortBoolCluster

packages/computer/src/git/cli.ts:701–711  ·  view source on GitHub ↗

* Expand a cluster of single-char boolean short flags (`-fd` -> * `-f -d`) when every character is in `chars`. Clusters with a * character outside the set are left untouched for the generic * parser to handle or reject. Only safe for flags that take no * value.

(args: string[], chars: Set<string>)

Source from the content-addressed store, hash-verified

699 * value.
700 */
701function expandShortBoolCluster(args: string[], chars: Set<string>): string[] {
702 const out: string[] = [];
703 for (const arg of args) {
704 if (/^-[a-z]{2,}$/i.test(arg) && [...arg.slice(1)].every((c) => chars.has(c))) {
705 for (const ch of arg.slice(1)) out.push(`-${ch}`);
706 continue;
707 }
708 out.push(arg);
709 }
710 return out;
711}
712
713function expandCommitShortCluster(args: string[]): string[] {
714 const out: string[] = [];

Callers 1

runCleanFunction · 0.85

Calls 2

hasMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected