(argv: string[])
| 27 | const OCO_EQUALS_PREFIXES = ['-c=', '--context=', '-y=', '--yes=', '--fgm=']; |
| 28 | |
| 29 | const stripOcoFlags = (argv: string[]): string[] => { |
| 30 | const out: string[] = []; |
| 31 | for (let i = 0; i < argv.length; i++) { |
| 32 | const a = argv[i]; |
| 33 | // String flags with a separate value token: -c <val>, --context <val> |
| 34 | if (OCO_FLAGS_WITH_VALUE.has(a)) { |
| 35 | i++; // skip the value token too |
| 36 | continue; |
| 37 | } |
| 38 | // Boolean flags: -y, --yes, --fgm |
| 39 | if (OCO_BOOLEAN_FLAGS.has(a)) { |
| 40 | continue; |
| 41 | } |
| 42 | // Equals form: -c=…, --context=…, -y=…, --yes=…, --fgm=… |
| 43 | if (OCO_EQUALS_PREFIXES.some((prefix) => a.startsWith(prefix))) { |
| 44 | continue; |
| 45 | } |
| 46 | out.push(a); |
| 47 | } |
| 48 | return out; |
| 49 | }; |
| 50 | |
| 51 | const rawArgv = process.argv.slice(2); |
| 52 | const extraArgs = stripOcoFlags(rawArgv); |
no test coverage detected
searching dependent graphs…