(argv: string[])
| 20 | * from, but it can no longer influence how bumpy itself was obtained. |
| 21 | */ |
| 22 | export 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 | |
| 47 | const DOCS_URL = 'https://github.com/dmno-dev/bumpy/blob/main/docs/github-actions.md'; |
| 48 |
no outgoing calls
no test coverage detected
searching dependent graphs…