/** * Flag-parsing internals for CommandParser (tokenizing, merging, value * coercion, key normalization). * File-size sweep: split out of parser.ts. Mixed into * CommandParser.prototype at the bottom of parser.ts. * * @module v1/cli/parser-flags */ import type { CommandParser } from './parser.js'; import type { ParsedFlags } from './types.js'; export declare const parserFlagMethods: { setFlagSafe(this: CommandParser, flags: ParsedFlags, key: string, value: string | number | boolean): void; /** * Merge a single parsed flag (or set of `_` positionals) into the * accumulated result flags, collecting repeats into an array instead of * overwriting. Declared `type: 'array'` options always end up as an array * (even a single occurrence); any other repeated flag also becomes an * array on its second occurrence rather than silently dropping the first * value. */ mergeParsedFlags(this: CommandParser, into: ParsedFlags, from: ParsedFlags, arrayFlags: Set, booleanFlags?: Set): void; /** * Convert a camelCase key to kebab-case (inverse of normalizeKey). */ camelToKebab(this: CommandParser, key: string): string; /** * Ensure every flag is reachable under both its camelCase and * kebab-case spelling. Runs once, after all flags (including * defaults) have been merged into the result. */ mirrorFlagKeys(this: CommandParser, flags: ParsedFlags): void; /** * True when `value` looks like a space-separated negative number * (`-0.5`, `-42`) rather than a new flag. Scoped narrowly to "leading `-` * immediately followed by a digit" — a legitimate flag name never starts * with a digit, so this can't misfire on a genuine following flag while * still letting `--threshold -0.5` consume `-0.5` as the value instead of * being misparsed as a new (bogus) flag. */ looksLikeNegativeNumber(this: CommandParser, value: string): boolean; parseFlag(this: CommandParser, args: string[], index: number, aliases: Record, booleanFlags: Set): { flags: ParsedFlags; nextIndex: number; }; /** * Set a declared boolean flag, consuming an immediately following literal * `true`/`false` as its value and returning the new cursor. * * Without this, `--success false` both set success=`true` AND left the token * "false" in the positional list — where any command that also accepts a * positional read it as that argument. `hooks post-task --task-id abc * --success false` therefore recorded task "false" as *successful* (issue * #269). `--flag=false` always worked; this makes the spaced form agree. */ setBooleanFlag(this: CommandParser, flags: ParsedFlags, key: string, args: string[], nextIndex: number): number; parseValue(this: CommandParser, value: string): string | number | boolean; normalizeKey(this: CommandParser, key: string): string; }; //# sourceMappingURL=parser-flags.d.ts.map