MCPcopy Create free account
hub / github.com/SethGammon/Citadel / parseArgs

Function parseArgs

scripts/worktree-readiness.js:12–34  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

10} = require('../core/worktree/readiness');
11
12function parseArgs(argv) {
13 const args = {
14 projectRoot: process.cwd(),
15 worktreePath: process.cwd(),
16 write: false,
17 json: false,
18 list: false,
19 };
20
21 for (let index = 2; index < argv.length; index++) {
22 const arg = argv[index];
23 const value = argv[index + 1];
24 if (arg === '--project-root') { args.projectRoot = path.resolve(value); index++; }
25 else if (arg === '--worktree') { args.worktreePath = path.resolve(value); index++; }
26 else if (arg === '--branch') { args.branch = value; index++; }
27 else if (arg === '--write') args.write = true;
28 else if (arg === '--json') args.json = true;
29 else if (arg === '--list') args.list = true;
30 else if (arg === '--help' || arg === '-h') args.help = true;
31 }
32
33 return args;
34}
35
36function usage() {
37 return [

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected