crt-ship 0.1.0: CLI, Claude Code skills and templates for shipping mobile games to Google Play and the App Store

This commit is contained in:
CRTkafa 2026-10-10 12:29:20 +00:00
commit ecb3dc3dc3
64 changed files with 4509 additions and 0 deletions

34
cli/lib/args.ts Normal file
View file

@ -0,0 +1,34 @@
// Tiny argv parser: positionals, --flag, --key value, --key=value.
export interface Args {
_: string[];
has(name: string): boolean;
get(name: string): string | undefined;
str(name: string, d: string): string;
num(name: string, d: number): number;
list(name: string): string[];
}
export function parseArgs(argv: string[], booleans: string[] = []): Args {
const flags = new Map<string, string>();
const _: string[] = [];
const bool = new Set(['dry', 'yes', 'help', 'json', 'verbose', ...booleans]);
for (let i = 0; i < argv.length; i++) {
const a = argv[i]!;
if (!a.startsWith('--')) { _.push(a); continue; }
const eq = a.indexOf('=');
if (eq > 0) { flags.set(a.slice(2, eq), a.slice(eq + 1)); continue; }
const name = a.slice(2);
const next = argv[i + 1];
if (bool.has(name) || name.startsWith('no-') || next === undefined || next.startsWith('--')) flags.set(name, 'true');
else { flags.set(name, next); i++; }
}
const get = (n: string) => flags.get(n);
return {
_,
has: n => flags.has(n),
get,
str: (n, d) => get(n) ?? d,
num: (n, d) => { const v = get(n); const x = v === undefined ? d : Number(v); if (Number.isNaN(x)) throw new Error(`--${n}: not a number`); return x; },
list: n => (get(n) ?? '').split(',').map(s => s.trim()).filter(Boolean),
};
}