Skip to content

takeConfigDir

takeConfigDir(argv): { dir?: string; rest: string[]; } | { error: string; }

Pull -C PATH / --dir PATH out of a config argument list.

Both tools document -C as a global flag, but the config branch runs BEFORE their own parsers, so without this the flag would be accepted and discarded — the tool would report the current directory’s project while the user was plainly pointing it somewhere else. Shared rather than written twice so the two tools cannot disagree about it.

All four spellings commander accepts for the same option are accepted here — -C X, -CX, --dir X, --dir=X — because the help text advertises one flag and a user has no way to know which parser will read it.

ParameterType
argvstring[]

{ dir?: string; rest: string[]; } | { error: string; }