refactor: normalize cli command hints

This commit is contained in:
Peter Steinberger
2026-01-20 07:42:21 +00:00
parent 11b9b6dba5
commit 6d5195c890
106 changed files with 521 additions and 220 deletions

View File

@@ -1,6 +1,8 @@
import os from "node:os";
import path from "node:path";
import { isValidProfileName } from "./profile-utils.js";
export type CliProfileParseResult =
| { ok: true; profile: string | null; argv: string[] }
| { ok: false; error: string };
@@ -21,12 +23,6 @@ function takeValue(
return { value: trimmed || null, consumedNext: Boolean(next) };
}
function isValidProfileName(value: string): boolean {
if (!value) return false;
// Keep it path-safe + shell-friendly.
return /^[a-z0-9][a-z0-9_-]{0,63}$/i.test(value);
}
export function parseCliProfileArgs(argv: string[]): CliProfileParseResult {
if (argv.length < 2) return { ok: true, profile: null, argv };