import { IOResult, type ByteSource } from '../../../io/types.ts';
import { PathSpec, type StatFn } from '../../../types.ts';
import type { CommandFnResult, Context } from '../../config.ts';
/**
 * GNU realpath's options, the last of each family winning: `mode` is `e`
 * (every component must exist), `m` (none has to) or empty (all but the
 * last, the default); `links` is `P` (resolve each link as the walk meets
 * it), `L` (resolve the `..` components first) or `s` (resolve none).
 * Mirrors Python's RealpathFlags.
 */
export interface RealpathFlags {
    mode: string;
    links: string;
    quiet: boolean;
    zero: boolean;
    relativeTo: string | null;
    relativeBase: string | null;
}
export declare function parseFlags(flags: Context['flags']): RealpathFlags;
/**
 * A path with its links resolved, the walk `realpath` and `readlink -f`
 * share. A relative word starts at the working directory.
 * Each named component is appended and, unless `nolinks`, a link there is
 * read (`readlink`, one link's target or null) and its target put in front
 * of the names left, so a `..` climbs from where a link leads. A link the
 * session cannot see is no link, as a hidden path is no path: `readlink` is
 * the dispatcher's reader, which answers none for it. A component
 * followed by `.` or `..` must be a directory. A trailing slash rejects an
 * existing non-directory. GNU 9.7's default mode accepts a missing final
 * component with a slash; `nolinks` also accepts missing parents. `e`
 * requires existence, while `m` checks nothing. A walk that comes back to a
 * link with the same names left is in a loop, `Too many levels of symbolic
 * links`, and so is one that meets more than LINK_LIMIT links, which covers
 * a link that grows the names it leaves (`a -> a/x`) and that GNU walks until
 * memory runs out. `m` instead leaves one link unresolved and goes on with
 * the names left after it: on a loop the one keptLink picks, past the limit
 * the link it stopped at. Throws the first check the walk fails. Mirrors
 * Python.
 */
export declare function canonicalize(word: string, cwd: string, mode: string, nolinks: boolean, readlink: ((path: string) => string | null) | null, stat: StatFn): Promise<string>;
/**
 * Print each operand's canonical path, GNU `realpath` (9.7). An operand
 * that does not resolve is reported and the rest still print, exit 1. A
 * `--relative-to` or `--relative-base` directory resolves the same way
 * first, and one that does not ends the command. Mirrors Python's realpath.
 */
export declare function realpath(paths: readonly PathSpec[], stat: StatFn, cwd?: string, readlink?: ((path: string) => string | null) | null, flags?: RealpathFlags): Promise<[ByteSource | null, IOResult]>;
export declare function realpathGeneric(paths: PathSpec[], texts: string[], ctx: Context, stat: (p: PathSpec) => Promise<unknown>): Promise<CommandFnResult>;
//# sourceMappingURL=realpath.d.ts.map