UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

41 lines • 2.39 kB
import type { RedirectResult } from '../../../../context/session_context.ts'; import type { ParseScope } from '../../../../shell/parse/scope.ts'; import type { MountRegistry } from '../../../mount/registry.ts'; import type { SessionState } from '../../../session/session.ts'; import type { BuiltinCall } from '../types.ts'; /** * Run the `type` builtin (`type [-afptP] name [name ...]`). * * Resolution matches `command -V`, but the exit rule is `type`'s: 0 only * when every name resolves. `-t` prints the classification word; `-p` * prints the file of a name that resolves to one (none for a builtin, * which still resolves) and `-P` searches PATH for one even past a * builtin, a miss there being a miss; the three are one group, the last * winning. `-a` prints one line per layer holding the name (a builtin * that is also a program ends with its file's line), `-f` ignores the * function table, and a missing name warns on stderr unless a word-only * mode (`-t`/`-p`/`-P`) is active. Pinned against bash 5.2 on * debian:stable-slim. */ export declare function handleType(args: readonly string[], session: SessionState, registry: MountRegistry, parser?: ParseScope): RedirectResult; /** * Run the `which` builtin (`which [-as] name [name ...]`). * * Pinned against debianutils `which` (debian:stable-slim): it prints the * file PATH finds for each name, which is the program's under `/usr/bin` * (the one PATH directory), a miss prints nothing at all, the exit status * is 0 only when every name resolves (1 with no operands), and `-s` * reports through the status alone. A builtin with no program (`cd`), a * function, an alias and a reserved word are no file, so each is a miss; * `-a` has one directory to search and so one line per name. `$PATH` * itself is not read: mirage runs a program by its name whatever PATH * holds, so `which` answers as dispatch does. The refusal for an unknown * option is bash's shape, not the C tool's `Illegal option`, because this * is a builtin. */ export declare function handleWhich(args: readonly string[], session: SessionState, registry: MountRegistry): RedirectResult; /** The `type` arm. */ export declare function typeBuiltin(call: BuiltinCall): Promise<RedirectResult>; /** The `which` arm. */ export declare function whichBuiltin(call: BuiltinCall): Promise<RedirectResult>; //# sourceMappingURL=lookup.d.ts.map