(argv)
| 688 | } |
| 689 | |
| 690 | function parseArgs(argv) { |
| 691 | const args = {}; |
| 692 | for (let index = 0; index < argv.length; index += 1) { |
| 693 | const item = argv[index]; |
| 694 | if (!item.startsWith("--")) { |
| 695 | continue; |
| 696 | } |
| 697 | const key = item.slice(2); |
| 698 | const next = argv[index + 1]; |
| 699 | if (!next || next.startsWith("--")) { |
| 700 | args[key] = "1"; |
| 701 | continue; |
| 702 | } |
| 703 | args[key] = next; |
| 704 | index += 1; |
| 705 | } |
| 706 | return args; |
| 707 | } |
| 708 | |
| 709 | function requiredArg(args, name) { |
| 710 | const value = args[name]; |
no outgoing calls
no test coverage detected