@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
28 lines • 1.62 kB
TypeScript
import { IOResult, type ByteSource } from '../../../io/types.ts';
import type { PathSpec } from '../../../types.ts';
import type { Context } from '../../config.ts';
import { type FlagValue } from '../../spec/types.ts';
export interface CmpFlags {
readonly silent: boolean;
readonly verbose: boolean;
readonly limit: number | null;
readonly printBytes: boolean;
readonly skip: readonly [number, number];
}
/**
* cmp's counts read by mirage-rs before any operand is resolved: -n, -i, -l
* and -s in the order typed, so the first refusal is the one diffutils makes
* while it reads its options, then the SKIP1 and SKIP2 operands of `texts`.
* The flags, or cmp's refusal, exit 2. A count past 2**53 is the nearest
* double, which no file reaches. Mirrors Python's `parse_flags`.
*/
export declare function parseFlags(bag: Record<string, FlagValue>, texts?: readonly string[]): CmpFlags | IOResult;
/**
* Compare two files byte by byte, GNU cmp semantics. Each file is streamed
* and the reads stop at the first difference, or at `-n`; only `-l`, which
* lists every difference, reads both to the end. Under `-s` two regular files
* whose sizes past their skips differ answer 1 unread, as diffutils does.
* Mirrors Python's cmp_cmd.
*/
export declare function cmpGeneric(parsed: CmpFlags, paths: PathSpec[], texts: readonly string[], ctx: Context, stream: (p: PathSpec) => AsyncIterable<Uint8Array>, sizeOf?: (p: PathSpec) => Promise<number | null>, lengthOf?: ((p: PathSpec) => Promise<number | null>) | undefined): Promise<[ByteSource | null, IOResult]>;
//# sourceMappingURL=cmp.d.ts.map