(argv: string[])
| 436 | } |
| 437 | |
| 438 | export function parseArgs(argv: string[]): CliArgs { |
| 439 | const args: CliArgs = { _: [] }; |
| 440 | for (let i = 0; i < argv.length; i += 1) { |
| 441 | const arg = argv[i]; |
| 442 | if (!arg) continue; |
| 443 | if (arg === "--") { |
| 444 | continue; |
| 445 | } |
| 446 | if (!arg.startsWith("--")) { |
| 447 | args._.push(arg); |
| 448 | continue; |
| 449 | } |
| 450 | const key = arg.slice(2); |
| 451 | const next = argv[i + 1]; |
| 452 | if (!next || next.startsWith("--")) { |
| 453 | args[key] = true; |
| 454 | } else { |
| 455 | args[key] = next; |
| 456 | i += 1; |
| 457 | } |
| 458 | } |
| 459 | return args; |
| 460 | } |
| 461 | |
| 462 | export function assertAllowedOwner(repo: string, allowedOwner?: string) { |
| 463 | if (!allowedOwner) return; |
no outgoing calls
no test coverage detected