import type { FlagView } from '../spec/types.ts'; /** * GNU's file-selection flags, threaded as one value. * * `fileGlobs` holds the --include/--exclude rules in command-line * order (the order decides ties, see `fileAdmitted`), `excludeDir` * prunes directories from the -r walk, and `text` (-a) lets the walk * read the extensions it would otherwise skip as binary. The empty * value admits everything, which is what every caller without the * flags passes. */ /** One --include/--exclude rule: a basename glob and its verdict. */ export interface FileGlob { glob: string; admit: boolean; } export interface WalkFilters { fileGlobs: readonly FileGlob[]; excludeDir: readonly string[]; text: boolean; } export declare const NO_FILTERS: WalkFilters; /** * The --include/--exclude rules a line typed, in line order. * * The bag lists each dest's values in occurrence order and the dests * themselves in first-typed order, so the rebuilt list is exact unless * a line alternates the two kinds three or more times (`--include a * --exclude b --include c`), where each kind's rules stay grouped at * its first position. Deliberate approximation: the bag is the only * channel a generic reads, and it carries no per-occurrence positions * across two dests. */ export declare function parseFileGlobs(fl: FlagView): readonly FileGlob[]; /** * GNU's --include/--exclude gate for one candidate file. * * Globs match the base name with fnmatch wildcards, case sensitively (a * glob carrying a slash therefore matches nothing, which is what GNU * 3.11 answers too). The rules resolve in command-line order, gnulib's * exclude list: the last matching rule decides, and a file matching * none is admitted only when the first rule is an exclude (both pinned * against GNU 3.11, where `--include='*.txt' --exclude='*.txt'` skips a * .txt file and the reversed order searches it). Applies to * command-line files exactly as to walked ones, which is pinned GNU * behavior: an explicit operand --include passes over is silently no * match, not an error. */ export declare function fileAdmitted(path: string, filters: WalkFilters): boolean; /** Whether the -r walk may descend into this directory. */ export declare function dirAdmitted(path: string, filters: WalkFilters): boolean; //# sourceMappingURL=grep_select.d.ts.map