Skip to content

ReadFlagsOptions

External state and behavior toggles accepted by readFlags.

Extends ResolveOptions, so env, config, prompter, stat, and mkdir carry the meaning they have during command resolution.

Signatures

ts
interface ReadFlagsOptions extends ResolveOptions {}

Members

Properties

adapter

Runtime source for argv, environment, and filesystem primitives.

ts
adapter?: RuntimeAdapter;

argv

User arguments only, without the binary and script entries.

ts
argv?: readonly string[];

config

Parsed config file contents keyed by dotted path segments.

ts
config?: Readonly<Record<string, unknown>>;

env

Environment variable snapshot injected by the caller.

ts
env?: Readonly<Record<string, string | undefined>>;

mkdir

Recursive directory creation for flag.path() and arg.path() create checks. When absent, missing paths are not created and existence rules apply as-is.

ts
mkdir?: { (path: string): Promise<void>; };

onDeprecation

Receiver for notices produced by .deprecated() flags.

ts
onDeprecation?: { (warning: DeprecationWarning): void; };

parse

Parser behavior such as kebab/camel case parity.

ts
parse?: ParseOptions;

prompter

Interactive prompt engine; absent in non-TTY / CI contexts.

ts
prompter?: PromptEngine;

stat

Filesystem probe for flag.path() and arg.path() checks: what exists at the path, or null when nothing does. When absent, path checks are skipped.

ts
stat?: { (path: string): Promise<"file" | "directory" | null>; };

stdinData

Pre-read stdin content, or null when stdin was not piped.

ts
stdinData?: string | null;

See Also

Released under the MIT License.