import { IOResult, type ByteSource } from '../../../io/types.ts';
import type { PathSpec } from '../../../types.ts';
import type { CommandFnResult, Context } from '../../config.ts';
import { type OpenStream } from '../../../rs/stream.ts';
/**
 * What join does with a line whose key sorts before the one above it. WARN,
 * the default, names the first such line of each file, but only once some
 * line has gone unpaired, then finishes and exits 1 under `input is not in
 * sorted order`. FAIL (`--check-order`) names the first one and stops there.
 * OFF (`--nocheck-order`) never looks. Mirrors OrderCheck in join.py.
 */
export declare enum OrderCheck {
    WARN = "warn",
    FAIL = "fail",
    OFF = "off"
}
/** A -o item: a file number and a field counted from 0; file 0 is the join field. */
export type Column = readonly [number, number];
/**
 * join's options as one line set them; every byte string is a byte view, one
 * character per byte. Mirrors JoinFlags in join.py.
 */
export interface JoinFlags {
    /** Each file's join field, counted from 0. */
    readonly keys: readonly [number, number];
    /** Whether each file's unpairable lines print (-a, -v). */
    readonly unpaired: readonly [boolean, boolean];
    /** Whether joined lines print; any -v clears it. */
    readonly paired: boolean;
    /** The -e text for an empty field. */
    readonly filler: string | null;
    /** The -o list. */
    readonly columns: readonly Column[];
    /** -o auto. */
    readonly autoColumns: boolean;
    /** The -t byte; null parts fields at runs of blanks, WHOLE_RECORD keeps each record whole. */
    readonly delimiter: string | null;
    /** What output fields are joined with. */
    readonly separator: string;
    /** -i. */
    readonly foldCase: boolean;
    /** What ends a record, NUL under -z. */
    readonly terminator: string;
    /** What an unsorted line does. */
    readonly order: OrderCheck;
    /** --header. */
    readonly header: boolean;
    /** The operand positions of FILE1 and FILE2. */
    readonly files: readonly [number, number];
}
export declare function parseFlags(flags: Context['flags'], operands?: readonly string[], argv?: readonly string[]): Promise<JoinFlags>;
export interface JoinIO {
    read: (p: PathSpec) => AsyncIterable<Uint8Array>;
    stdin: ByteSource | null;
    flags: JoinFlags;
    engine?: OpenStream;
}
/**
 * GNU `join` of two files over already-parsed options: `paths` are the
 * operands, of which `flags.files` names the two files. Mirrors join in
 * join.py.
 */
export declare function join(paths: PathSpec[], io: JoinIO): [ByteSource | null, IOResult];
/**
 * The builder's entry point: parse the line's flags, then `join`. Each operand's
 * glob expands on its own, so the option loop sees its matches where the
 * word was typed (`join -j1 2 *.txt`). Mirrors join_generic in join.py.
 */
export declare function joinGeneric(paths: PathSpec[], ctx: Context, resolveGlob: (targets: PathSpec[]) => Promise<PathSpec[]>, read: (p: PathSpec) => AsyncIterable<Uint8Array>): Promise<CommandFnResult>;
//# sourceMappingURL=join.d.ts.map