* 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>)
| 699 | * value. |
| 700 | */ |
| 701 | function 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 | |
| 713 | function expandCommitShortCluster(args: string[]): string[] { |
| 714 | const out: string[] = []; |