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

Function parseArgs

scripts/install-hooks.js:25–62  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

23const claudeRuntime = require('../runtimes/claude-code/runtime');
24
25const CITADEL_ROOT = path.resolve(__dirname, '..');
26
27function parseArgs(argv) {
28 const args = argv.slice(2);
29 const options = {
30 projectRoot: process.env.CLAUDE_PROJECT_DIR || process.cwd(),
31 hookProfile: process.env.CITADEL_CLAUDE_HOOK_PROFILE || 'auto',
32 claudeVersion: process.env.CITADEL_CLAUDE_VERSION || null,
33 };
34
35 for (let index = 0; index < args.length; index++) {
36 const arg = args[index];
37
38 if (arg === '--hook-profile' && args[index + 1]) {
39 options.hookProfile = args[++index];
40 continue;
41 }
42
43 if (arg.startsWith('--hook-profile=')) {
44 options.hookProfile = arg.split('=')[1];
45 continue;
46 }
47
48 if (arg === '--claude-version' && args[index + 1]) {
49 options.claudeVersion = args[++index];
50 continue;
51 }
52
53 if (arg.startsWith('--claude-version=')) {
54 options.claudeVersion = arg.split('=')[1];
55 continue;
56 }
57
58 if (!arg.startsWith('--') && options.projectRoot === (process.env.CLAUDE_PROJECT_DIR || process.cwd())) {
59 options.projectRoot = arg;
60 }
61 }
62
63 return options;
64}
65

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected