MCPcopy Create free account
hub / github.com/dmno-dev/bumpy / extractCwdFlag

Function extractCwdFlag

packages/bumpy/src/utils/cwd.ts:22–45  ·  view source on GitHub ↗
(argv: string[])

Source from the content-addressed store, hash-verified

20 * from, but it can no longer influence how bumpy itself was obtained.
21 */
22export function extractCwdFlag(argv: string[]): CwdParseResult {
23 const rest: string[] = [];
24 let cwd: string | undefined;
25 for (let i = 0; i < argv.length; i++) {
26 const arg = argv[i]!;
27 if (arg === '--cwd') {
28 const next = argv[i + 1];
29 if (next === undefined || next.startsWith('--')) {
30 throw new Error('--cwd requires a directory argument');
31 }
32 cwd = next;
33 i++;
34 continue;
35 }
36 if (arg.startsWith('--cwd=')) {
37 const val = arg.slice('--cwd='.length);
38 if (val === '') throw new Error('--cwd requires a directory argument');
39 cwd = val;
40 continue;
41 }
42 rest.push(arg);
43 }
44 return { cwd, rest };
45}
46
47const DOCS_URL = 'https://github.com/dmno-dev/bumpy/blob/main/docs/github-actions.md';
48

Callers 2

cwd.test.tsFile · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…