UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

42 lines • 2.11 kB
import { type Chunk, type Piece } from './types.ts'; /** * What `"$*"` joins the parameters with: the first character of IFS, a * space when IFS is unset (null) and nothing when it is empty. */ export declare function ifsJoiner(ifs: string | null): string; /** * An expansion's value as a piece of the word it sits in. Inside double * quotes the value is literal: its glob characters are marked and it * never splits. Unquoted, it splits and globs. */ export declare function valuePiece(text: string, quoted: boolean): Piece; /** * The elements of a splat, a field boundary between each two. A long splat * yields between its elements, so a cancel or the line's deadline lands * mid-list. */ export declare function splatChunks(elements: readonly string[], joiner: string, quoted: boolean): Promise<Chunk[]>; /** * The text of a word where no field splitting happens. An assignment, a * `case` word, `[[ ]]` and a here-string read the pieces as one string, * a splat boundary as its joiner. */ export declare function joinChunks(chunks: Iterable<Chunk>): string; /** The literal text of a word's pieces, glob marks removed. */ export declare function chunksText(chunks: Iterable<Chunk>): string; /** * Split a word's pieces into fields on IFS, as bash does. * * Only split pieces are split. An IFS whitespace run delimits a field * and is dropped at either end; any other IFS character, with the * whitespace around it, delimits exactly one field, so `a,,b` under * `IFS=,` is three fields and `a,` is one. A splat boundary always ends * a field. A field exists once literal or quoted text, or a non-empty * split, opened it, so an unquoted expansion that comes back empty is * no word at all while `""` is an empty one. `ifs` is null when unset. A * word of many pieces, or a value that splits into many fields, yields * between them, so a cancel or the line's deadline lands mid-split; a run * with no separator is found in one search. */ export declare function splitFields(chunks: Iterable<Chunk>, ifs: string | null): Promise<string[]>; //# sourceMappingURL=fields.d.ts.map