MCPcopy Create free account
hub / github.com/decaporg/decap-cms / parseArgs

Function parseArgs

scripts/smoke-install-packed.mjs:52–68  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

50}
51
52function parseArgs(argv) {
53 const options = { clients: CLIENTS, keep: false };
54 for (const arg of argv) {
55 if (arg === '--keep') {
56 options.keep = true;
57 } else if (arg.startsWith('--clients=')) {
58 options.clients = arg.slice('--clients='.length).split(',').filter(Boolean);
59 const unknown = options.clients.filter(client => !CLIENTS.includes(client));
60 if (unknown.length > 0) {
61 throw new Error(`Unknown client(s): ${unknown.join(', ')}`);
62 }
63 } else {
64 throw new Error(`Unknown argument: ${arg}`);
65 }
66 }
67 return options;
68}
69
70class StepError extends Error {}
71

Callers 1

mainFunction · 0.70

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected