UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

46 lines • 2.45 kB
import type { CommandSpec } from '../../../../commands/spec/types.ts'; import type { RedirectResult } from '../../../../context/session_context.ts'; import type { SessionState } from '../../../session/session.ts'; import type { BuiltinCall } from '../types.ts'; export declare const TOPICS: readonly string[]; /** A spec's free text as paragraphs, split at its blank lines. */ export declare function paragraphs(text: string | null): string[]; /** The one line a spec's description opens with. */ export declare function summary(spec: CommandSpec): string; /** * Each option of a builtin, as its help lists it: the letter and the name of * its value, and what it does. */ export declare function optionRows(spec: CommandSpec): [string, string][]; /** * Lay text out in lines of at most `width` characters. Words go on a line * while they fit; a word that does not fit breaks after its last hyphen that * still does, and a word longer than a line with nowhere to break runs past * it. This is how a manual page fills text with justification and * hyphenation off. */ export declare function fill(text: string, width: number): string[]; /** What `help NAME` and `NAME --help` print. */ export declare function topicHelp(name: string): string; /** * The width the first of `names` sets, read as C's `atoi` reads it, passing * over one under `least`; `fallback` when none sets one. */ export declare function envWidth(session: SessionState, names: readonly string[], least: number, fallback: number): number; /** Whether the session may not run a builtin at all, which the listing marks with a star. */ export declare function disabled(name: string, session: SessionState): boolean; /** The topics a pattern names: the one it spells exactly, else every one it begins or matches as a glob. */ export declare function matching(pattern: string): string[]; /** * A builtin's answer to `--help` as its first word: its help, and status 2. * Null for a word that reads `--help` as an operand, and for any word that is * no builtin. */ export declare function flagHelp(name: string): RedirectResult | null; /** * The `help` arm: the listing, or what each pattern names. `-d` wins over * `-m` and `-m` over `-s`. A pattern that matches nothing is passed over; * only when none matches is there an error, and it names the last. */ export declare function helpBuiltin(call: BuiltinCall): Promise<RedirectResult>; //# sourceMappingURL=help.d.ts.map