@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
46 lines • 2.31 kB
TypeScript
import { IOResult, type ByteSource } from '../../../io/types.ts';
import { PathSpec, type ReaddirFn, type StatFn } from '../../../types.ts';
import type { Context } from '../../config.ts';
import { type FlagValue } from '../../spec/types.ts';
export interface DiffFlags {
readonly ignoreCase: boolean;
readonly ignoreAllSpace: boolean;
readonly ignoreSpaceChange: boolean;
readonly ed: boolean;
readonly unified: boolean;
readonly context: number;
readonly brief: boolean;
readonly recursive: boolean;
/** -N reads a file missing on either side as empty. */
readonly newFile: boolean;
/** --unidirectional-new-file (or -N) reads one missing from the first so. */
readonly newFirst: boolean;
/** -s reports a pair that does not differ. */
readonly identical: boolean;
readonly exclude: readonly string[];
readonly excludeFrom: readonly PathSpec[];
}
/**
* diff's options, -U refused by the diff engine before any operand: the
* flags, or diff's refusal of a -U, exit 2. Mirrors Python's `parse_flags`.
*/
export declare function parseFlags(bag: Record<string, FlagValue>): DiffFlags | IOResult;
/**
* A file name as GNU diff writes it in a header line. GNU diff double-quotes
* a name holding a space, a double quote, a backslash or a control
* character, and writes each of those but the space as a C escape
* (`"sp ace"`, `"t\\tab"`); any other name, bytes above ASCII included, is
* written as it is. The `---` and `+++` lines and the `diff -r` line use it;
* the `Only in` and `Files ... differ` lines do not. Mirrors Python's
* `quote_header_name`.
*/
export declare function quoteHeaderName(name: string): string;
/**
* The option words of a diff line, as GNU echoes them. GNU diff permutes its
* options in front of its operands and prints them, word for word and in
* order, on each `diff -r` header line: an option's detached value is its
* own word, `--` is kept, and every operand is left out.
*/
export declare function switchWords(argv: readonly string[]): string[];
export declare function diffGeneric(flags: DiffFlags, paths: PathSpec[], ctx: Context, read: (p: PathSpec) => AsyncIterable<Uint8Array>, readdir: ReaddirFn, backendStat: StatFn): Promise<[ByteSource | null, IOResult]>;
//# sourceMappingURL=diff.d.ts.map