MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parseArgs

Function parseArgs

graph-ui/tools/net-deny-gate.mjs:158–179  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

156// ------------------------------------------------------------------ Main ----
157
158function parseArgs(argv) {
159 const args = argv.slice(2);
160 const sep = args.indexOf('--');
161 if (sep === -1 || sep === args.length - 1) {
162 throw new Error(
163 'Aufruf: node tools/net-deny-gate.mjs [--out <datei>] [--interval <ms>] ' +
164 '[--min-samples <n>] -- <cmd...>',
165 );
166 }
167 const options = {
168 out: null,
169 intervalMs: DEFAULT_INTERVAL_MS,
170 minSamples: DEFAULT_MIN_SAMPLES,
171 };
172 for (let i = 0; i < sep; i += 1) {
173 if (args[i] === '--out') { options.out = args[i + 1]; i += 1; continue; }
174 if (args[i] === '--interval') { options.intervalMs = Number(args[i + 1]); i += 1; continue; }
175 if (args[i] === '--min-samples') { options.minSamples = Number(args[i + 1]); i += 1; continue; }
176 throw new Error(`unbekannte Option: ${args[i]}`);
177 }
178 return { options, command: args.slice(sep + 1) };
179}
180
181async function main() {
182 const { options, command } = parseArgs(process.argv);

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected