MCPcopy
hub / github.com/affaan-m/ECC / parseArgs

Function parseArgs

scripts/repair.js:16–43  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

14}
15
16function parseArgs(argv) {
17 const args = argv.slice(2);
18 const parsed = {
19 targets: [],
20 dryRun: false,
21 json: false,
22 help: false,
23 };
24
25 for (let index = 0; index < args.length; index += 1) {
26 const arg = args[index];
27
28 if (arg === '--target') {
29 parsed.targets.push(args[index + 1] || null);
30 index += 1;
31 } else if (arg === '--dry-run') {
32 parsed.dryRun = true;
33 } else if (arg === '--json') {
34 parsed.json = true;
35 } else if (arg === '--help' || arg === '-h') {
36 parsed.help = true;
37 } else {
38 throw new Error(`Unknown argument: ${arg}`);
39 }
40 }
41
42 return parsed;
43}
44
45function printHuman(result) {
46 if (result.results.length === 0) {

Callers 15

mainFunction · 0.70
mainFunction · 0.70
runTestsFunction · 0.50
runTestsFunction · 0.50
runTestsFunction · 0.50
runTestsFunction · 0.50
runTestsFunction · 0.50
runTestsFunction · 0.50
runTestsFunction · 0.50
runTestsFunction · 0.50

Calls

no outgoing calls

Tested by 12

runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runTestsFunction · 0.40
runFunction · 0.40