UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

74 lines • 3.82 kB
import { FlagView } from '../../spec/flag_view.ts'; import { FileStat, LineFacts, PathSpec, type LsIndicator, type LsLinkMode, type LsSortBy, type LsTimeKind, type ReaddirFn, type StatFn } from '../../../types.ts'; import type { CommandFnResult, Context } from '../../config.ts'; import type { StatPath } from '../../../view/types.ts'; import { type LsColumns } from '../utils/formatting.ts'; export declare const LS_OK = 0; export declare const LS_MINOR_PROBLEM = 1; export declare const LS_FAILURE = 2; interface LsWarning { message: string; serious: boolean; } export declare function exitStatusFor(warnings: readonly LsWarning[]): number; /** * The mark GNU appends to a name for a style (coreutils 9.7). A directory is * `/` in every style but none; `slash` marks nothing else. A link is `@` and a FIFO `|`; an executable regular file is * `*`, but only under classify. The mark rides the row's own type and mode, so * it needs no separate lookup; a row nothing could stat (a dangling link's * target) takes none. Mirrors Python's type_indicator. */ export declare function typeIndicator(entry: FileStat | null, style: LsIndicator): string; export declare function uriEscape(path: string): string; /** * Indices of `names` (none holding a NUL) in `ls -v` order, each once; * equal names keep their input order. Mirrors sort_by_version in ls.py. */ export declare function sortByVersion(names: readonly string[]): Promise<number[]>; export declare function sortStats(stats: readonly FileStat[], sortBy: LsSortBy, reverse: boolean, timeKind?: LsTimeKind, groupDirsFirst?: boolean, escape?: boolean): Promise<FileStat[]>; /** The ls flag bag, parsed once. */ export interface LsFlags { readonly long: boolean; readonly all: boolean; readonly showDotEntries: boolean; readonly human: boolean; readonly reverse: boolean; readonly indicator: LsIndicator; readonly recursive: boolean; readonly listDir: boolean; readonly deref: boolean; readonly followArgs: boolean; readonly sortBy: LsSortBy; readonly timeKind: LsTimeKind; readonly groupDirsFirst: boolean; readonly columns: LsColumns; readonly escape: boolean; readonly hyperlink: boolean; } /** * The indicator style a line asks for: the last of -F/--classify[=WHEN], -p, * --file-type and --indicator-style wins, and every one is checked on the * way, as GNU checks each value while it reads the options (coreutils 9.7). * Mirrors Python's indicator_flag. */ export declare function indicatorFlag(fl: FlagView): LsIndicator; /** * Which command-line links GNU ls resolves before it lists them. GNU settles * it once: the last of -L, -H and --dereference-command-line-symlink-to-dir * wins, and with none of them -d, a long format or the classify style resolve * no link while anything else resolves one that leads to a directory * (coreutils 9.7). A value the command refuses leaves the style unclassified, * since that line fails before it lists anything. `indicator` is the style a * scan of the whole line already read; without it the indicator options are * read here. Mirrors Python's link_mode. */ export declare function linkMode(fl: FlagView, indicator?: LsIndicator): LsLinkMode; /** * An ls line resolves the command-line links `linkMode` says, and walks, and * reads, below its operands under `-R`. Mirrors Python's `facts`. */ export declare function facts(fl: FlagView, _operands: readonly (string | PathSpec)[]): LineFacts; export declare function parseFlags(fl: FlagView): LsFlags; export declare function lsGeneric(paths: PathSpec[], ctx: Context, readdir: ReaddirFn<[path: PathSpec, nofollow?: boolean, limit?: number]>, stat: StatFn, statPath?: StatPath | null, flags?: LsFlags): Promise<CommandFnResult>; export {}; //# sourceMappingURL=ls.d.ts.map