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

Function parseFlags

packages/bumpy/src/cli.ts:8–24  ·  view source on GitHub ↗
(args: string[])

Source from the content-addressed store, hash-verified

6import { log, colorize } from './utils/logger.ts';
7
8function parseFlags(args: string[]): Record<string, string | boolean> {
9 const flags: Record<string, string | boolean> = {};
10 for (let i = 0; i < args.length; i++) {
11 const arg = args[i]!;
12 if (arg.startsWith('--')) {
13 const key = arg.slice(2);
14 const next = args[i + 1];
15 if (next && !next.startsWith('--')) {
16 flags[key] = next;
17 i++;
18 } else {
19 flags[key] = true;
20 }
21 }
22 }
23 return flags;
24}
25
26async function main() {
27 try {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…