@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
25 lines • 1.35 kB
TypeScript
import { IOResult } from '../../../io/types.ts';
import { type PathSpec, type StatFn, type ReadStreamFn } from '../../../types.ts';
import type { CommandFnResult, Context } from '../../config.ts';
import { type FlagValue } from '../../spec/types.ts';
export interface HeadFlags {
readonly lines: number;
readonly bytesMode: number | null;
readonly quiet: boolean;
readonly verbose: boolean;
readonly zeroTerminated: boolean;
}
/**
* head's options, -n and -c read by mirage-rs before any operand is resolved:
* the flags, or head's refusal of a count. Mirrors Python's `parse_flags`.
*/
export declare function parseFlags(bag: Record<string, FlagValue>): HeadFlags | IOResult;
/**
* Run head over resolved operands, GNU semantics. A line count (`-n N`, or
* the default 10) is asked of `firstLines` first, so a mount that can fetch
* the start of a file on its own (a `LIMIT` on a table) does not send the
* rest; null, or no `firstLines`, reads the file. Mirrors Python's
* `head_generic`; `parsed` holds the options, read before the operands were.
*/
export declare function headGeneric(parsed: HeadFlags, paths: PathSpec[], texts: string[], ctx: Context, stat: StatFn, stream: ReadStreamFn, firstLines?: (p: PathSpec, n: number) => Promise<Uint8Array | null>): Promise<CommandFnResult>;
//# sourceMappingURL=head.d.ts.map