import { UsageError } from '../errors.ts'; /** GNU usage-error exit code for a command. */ export declare function usageExitCode(cmdName: string): number; /** Exit code of a command refused on one operand before it ran. */ export declare function operandExitCode(cmdName: string): number; export declare function readFailExitCode(cmdName: string, err: unknown): number; /** * The same code, for a read failure known only as a rendered line. * * The cross-mount stream path fetches each operand with a native `cat` * sub-run, so a failed operand arrives as cat's rendered stderr rather * than as an error. That line is already respelled into the real * command's voice, and the exit code has to follow it or `sort a * /other/missing` answers 1 while `sort missing` answers 2, a split GNU * does not have. Classified against the very strerrors the renderer * wrote, so the forward and backward directions cannot drift; a blob that * carries no failed-read line keeps the catch-all 1. * * One fetch can render several lines, because one operand can be a glob * the owning mount expanded, and the most severe code is the answer: sed * is the only stream command whose code depends on the errno, and its rule * is the most severe (4 beats 2), which is also how the caller folds one * operand's code into the next. * * Mirrors the python `read_fail_exit_line`. */ export declare function readFailExitCodeFromLine(cmdName: string, rendered: string): number; export declare function unknownOptionError(cmdName: string, token: string): [Uint8Array, number]; /** * getopt_long refusal for an abbreviated long matching several options. * * Shape pinned against real GNU (`grep --c`): the typed spelling, then * every possibility quoted in declaration order on one line. The * per-tool usage dump GNU appends is deliberately omitted, like * unknownOptionError. */ export declare function ambiguousOptionError(cmdName: string, token: string, candidates: readonly string[]): [Uint8Array, number]; /** * Refusal for a non-integer value on an int-typed option. * * No GNU tool declares types through getopt (each words its own refusal, * e.g. `head: invalid number of lines`), so this mirrors argparse's * `invalid int value: 'abc'` with the option attributed the way * invalidArgumentError does. */ export declare function invalidIntError(cmdName: string, option: string, value: string): [Uint8Array, number]; /** * Refusal for a non-number value on a float-typed option. Mirrors * argparse's `invalid float value: '5x'` the same way invalidIntError * mirrors the int wording. */ export declare function invalidFloatError(cmdName: string, option: string, value: string): [Uint8Array, number]; /** GNU-shaped error for a declared value flag with no argument left. */ export declare function missingValueError(cmdName: string, token: string): [Uint8Array, number]; /** * GNU tar refusal for an old-style cluster letter with no argument. * * First line and exit pinned against GNU tar 1.35 (`tar xzf` with * nothing after it, and `tar cfC a.tar`, which names C). tar's own * wording, capital and full stop included, because it counts the * cluster's argument needs before argp sees the line at all. * * The hint line is deliberately mirage's, not GNU's: GNU offers * `Try 'tar --help' or 'tar --usage' for more information.` because argp * gives every argp program a `--usage`, and mirage's tar serves only * `--help`. Naming a flag that does not exist would be worse than the * shorter hint, and every other refusal here words it this way, so tar's * two refusals stay consistent with each other. */ export declare function oldOptionError(cmdName: string, letter: string): [Uint8Array, number]; /** * GNU ARGMATCH refusal for a value outside a declared choices set. * * Shape pinned against real GNU (`tee --output-error=bogus`): the * offending value, the option's canonical long spelling, then every valid * argument in declaration order, one per line. */ export declare function invalidArgumentError(cmdName: string, option: string, value: string, choices: readonly string[]): [Uint8Array, number]; /** * Refusal for a declared required option absent from the line. * * No GNU tool declares required options through getopt, so there is no * GNU shape to pin; this follows the unrecognized-option pattern (click * reports the same condition as "Missing option"). */ export declare function missingRequiredError(cmdName: string, option: string): [Uint8Array, number]; /** * The `Try ' --help'` line as that command prints it. * * coreutils writes the hint bare; diffutils routes it through `error()`, * so cmp and diff carry the command prefix on the hint line too. */ export declare function usageHint(cmdName: string): string; /** * GNU-shaped usage error for an operand past a command's arity. * * Shapes pinned against real GNU: `: extra operand ''` with the * `Try '--help'` hint (diff and cmp prefix the hint line with the command * name; mktemp says `too many templates` with no operand). The operand must * be the as-typed spelling (`rawPath`), never the resolved path. */ export declare function extraOperandError(cmdName: string, operand: string): UsageError; //# sourceMappingURL=usage.d.ts.map