- Set VERSION = '0.1.4' in brand.ts as single source of truth - Import VERSION in cli.ts for --version output - Remove dead code resolveFlagName from cli.ts - Remove hardcoded version comment from index.ts Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { GREEN, CYAN, RESET } from "./terminal";
|
import { GREEN, CYAN, RESET } from "./terminal";
|
||||||
|
|
||||||
export const VERSION = "0.1.3";
|
export const VERSION = "0.1.4";
|
||||||
|
|
||||||
export function showBanner(): string {
|
export function showBanner(): string {
|
||||||
const G = GREEN();
|
const G = GREEN();
|
||||||
|
|||||||
+3
-14
@@ -1,6 +1,8 @@
|
|||||||
// Lightweight CLI argument parser aligned with mainstream CLI conventions.
|
// Lightweight CLI argument parser aligned with mainstream CLI conventions.
|
||||||
// Supports: subcommands, short/long flags, flag values, positional args, --help, --version.
|
// Supports: subcommands, short/long flags, flag values, positional args, --help, --version.
|
||||||
|
|
||||||
|
import { VERSION } from "./brand";
|
||||||
|
|
||||||
export interface FlagDef {
|
export interface FlagDef {
|
||||||
long: string; // e.g. "dry-run"
|
long: string; // e.g. "dry-run"
|
||||||
short?: string; // e.g. "d"
|
short?: string; // e.g. "d"
|
||||||
@@ -44,19 +46,6 @@ function buildFlagIndex(flags: FlagDef[]): Map<string, FlagDef> {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveFlagName(raw: string): { flag: FlagDef; value?: string } | null {
|
|
||||||
// "--key=value"
|
|
||||||
const eqIndex = raw.indexOf("=");
|
|
||||||
if (eqIndex !== -1) {
|
|
||||||
const name = raw.slice(0, eqIndex);
|
|
||||||
const value = raw.slice(eqIndex + 1);
|
|
||||||
const allFlags = buildFlagIndex([...GLOBAL_FLAGS]); // we'll rebuild in context
|
|
||||||
// We'll handle = syntax in the main parse loop with proper index
|
|
||||||
return null; // handled inline
|
|
||||||
}
|
|
||||||
return null; // handled inline
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseArgs(
|
function parseArgs(
|
||||||
rawArgs: string[],
|
rawArgs: string[],
|
||||||
commands: Map<string, CommandDef>,
|
commands: Map<string, CommandDef>,
|
||||||
@@ -282,7 +271,7 @@ export async function runCLI(rawArgs: string[], commands: Map<string, CommandDef
|
|||||||
|
|
||||||
// Handle --version globally
|
// Handle --version globally
|
||||||
if (result.flags["version"]) {
|
if (result.flags["version"]) {
|
||||||
console.log("gai v0.1.3");
|
console.log(`gai v${VERSION}`);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user