diff --git a/src/settings.ts b/src/settings.ts index f9166b99..6c474fb4 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -11,97 +11,143 @@ export const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter = { readdirSync: fs.readdirSync }; +// tslint:disable no-redundant-jsdoc export interface Options { /** - * The maximum number of concurrent calls to `fs.readdir`. + * Return the absolute path for entries. + * + * @default false */ - concurrency?: number; + absolute?: boolean; /** - * The current working directory in which to search. + * If set to `true`, then patterns without slashes will be matched against + * the basename of the path if it contains slashes. + * + * @default false */ - cwd?: string; + baseNameMatch?: boolean; /** - * The deep option can be set to true to traverse the entire directory structure, - * or it can be set to a number to only traverse that many levels deep. + * Enables Bash-like brace expansion. + * + * @default true */ - deep?: number; + braceExpansion?: boolean; /** - * Add an array of glob patterns to exclude matches. + * Enables a case-sensitive mode for matching files. + * + * @default true */ - ignore?: Pattern[]; + caseSensitiveMatch?: boolean; /** - * Allow patterns to match filenames starting with a period (files & directories), - * even if the pattern does not explicitly have a period in that spot. + * Specifies the maximum number of concurrent requests from a reader to read + * directories. + * + * @default Infinity */ - dot?: boolean; + concurrency?: number; /** - * Return `Entry` object instead of filepath. + * The current working directory in which to search. + * + * @default process.cwd() */ - objectMode?: boolean; + cwd?: string; /** - * Return `fs.Stats` with `path` property instead of file path. + * Specifies the maximum depth of a read directory relative to the start + * directory. + * + * @default Infinity */ - stats?: boolean; + deep?: number; /** - * Return only files. + * Allow patterns to match entries that begin with a period (`.`). + * + * @default false */ - onlyFiles?: boolean; + dot?: boolean; /** - * Return only directories. + * Enables Bash-like `extglob` functionality. + * + * @default true */ - onlyDirectories?: boolean; + extglob?: boolean; /** * Indicates whether to traverse descendants of symbolic link directories. - * Also, if the `stats` option is specified, it tries to get `fs.Stats` for symbolic link file. + * + * @default true */ followSymbolicLinks?: boolean; /** - * Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. + * Custom implementation of methods for working with the file system. + * + * @default fs.* */ - throwErrorOnBrokenSymbolicLink?: boolean; + fs?: Partial; /** - * Prevent duplicate results. + * Enables recursively repeats a pattern containing `**`. + * If `false`, `**` behaves exactly like `*`. + * + * @default true */ - unique?: boolean; + globstar?: boolean; /** - * Add a `/` character to directory entries. + * An array of glob patterns to exclude matches. + * This is an alternative way to use negative patterns. + * + * @default [] */ - markDirectories?: boolean; + ignore?: Pattern[]; /** - * Return absolute paths for matched entries. + * Mark the directory path with the final slash. + * + * @default false */ - absolute?: boolean; + markDirectories?: boolean; /** - * Enable expansion of brace patterns. + * Returns objects (instead of strings) describing entries. + * + * @default false */ - braceExpansion?: boolean; + objectMode?: boolean; /** - * Enable matching with globstars (`**`). + * Return only directories. + * + * @default false */ - globstar?: boolean; + onlyDirectories?: boolean; /** - * Enable extglob support, so that extglobs are regarded as literal characters. + * Return only files. + * + * @default true */ - extglob?: boolean; + onlyFiles?: boolean; /** - * Enable a case-sensitive regex for matching files. + * Enables an object mode (`objectMode`) with an additional `stats` field. + * + * @default false */ - caseSensitiveMatch?: boolean; + stats?: boolean; /** - * Allow glob patterns without slashes to match a file path based on its basename. - * For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + * By default this package suppress only `ENOENT` errors. + * Set to `true` to suppress any error. + * + * @default false */ - baseNameMatch?: boolean; + suppressErrors?: boolean; /** - * Suppress any errors from reader. - * Can be useful when the directory has entries with a special level of access. + * Throw an error when symbolic link is broken if `true` or safely + * return `lstat` call if `false`. + * + * @default false */ - suppressErrors?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; /** - * Custom implementation of methods for working with the file system. + * Ensures that the returned entries are unique. + * + * @default true */ - fs?: Partial; + unique?: boolean; } +// tslint:enable no-redundant-jsdoc export default class Settings { public readonly absolute: boolean = this._getValue(this._options.absolute, false);