MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / parseArgs

Function parseArgs

scripts/bench-full-compare.mjs:40–77  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

38}
39
40function parseArgs(argv) {
41 const opts = {
42 baselinePath: DEFAULT_BASELINE,
43 currentPath: DEFAULT_CURRENT,
44 reportJsonPath: DEFAULT_REPORT_JSON,
45 reportMdPath: DEFAULT_REPORT_MD,
46 };
47
48 for (let i = 2; i < argv.length; i++) {
49 const arg = argv[i];
50 switch (arg) {
51 case "--baseline":
52 opts.baselinePath = argv[++i] ?? "";
53 break;
54 case "--current":
55 opts.currentPath = argv[++i] ?? "";
56 break;
57 case "--report-json":
58 opts.reportJsonPath = argv[++i] ?? "";
59 break;
60 case "--report-md":
61 opts.reportMdPath = argv[++i] ?? "";
62 break;
63 case "--help":
64 case "-h":
65 printHelp();
66 process.exit(0);
67 break;
68 default:
69 die(`unknown argument: ${arg}`);
70 }
71 }
72
73 if (!opts.baselinePath || !opts.currentPath || !opts.reportJsonPath || !opts.reportMdPath) {
74 die("--baseline, --current, --report-json, and --report-md require values");
75 }
76 return opts;
77}
78
79function printHelp() {
80 process.stdout.write(

Callers 1

mainFunction · 0.70

Calls 2

printHelpFunction · 0.70
dieFunction · 0.70

Tested by

no test coverage detected