Interface StoredParserOpts

Hierarchy

  • StoredParserOpts

Properties

deprecatedCommands: "error" | "unknown-command"

What to do when a user runs a deprecated command.

environmentPrefix: undefined | string

The prefix to use when falling back to environment variables for missing arguments.

keyEqualsValueSyntax: boolean

Whether to enable the "key = value" syntax: When enabled, the values are parsed as if normal syntax was used

--flag=value -x
=> {
flag: "value",
x: true,
}

Otherwise, an error is thrown.

logger: Logger

The logger used by the library to provide diagnostic information.

mustProvideCommand: boolean

Whether users must provide at least one command.

negatedBooleanPrefix: string

The prefix to use for "negated boolean" syntax. An empty string means this feature is disabled.

--no-flag --other-flag
=> {
flag: false,
['other-flag']: true
}
programDescription: string

The program description, shown in the help text.

programName: string

The program name, shown in the help text.

programVersion: string

The program version, shown in the help text.

resolvers: Resolver[]

The resolvers used by default. These are copied into the ArgState when a Args parser is constructed.

restSyntax: "error" | "collect"

Whether to enable the "rest" syntax: When enabled, the values are collected

--flag value -x -- the rest value goes here
=> {
flag: "value",
x: true,
rest: "the rest value goes here"
}

Otherwise, an error is thrown.

Remarks

When this is enabled, it will overwrite any arguments with the long flag of "rest"

shortFlagGroups: boolean

Whether to enable the "short flag group" syntax When enabled, groups of short flags are parsed as if they had all been specified individually

-xyz -ab
=> {
x: true,
y: true,
z: true,
a: true,
b: true
}

Otherwise, a group is treated as a single argument.

Remarks

This feature makes the assumption that any short flag with length > 1 is a group, even if it maps to a real short flag

unrecognisedArgument: "throw" | "skip"

What to do when an unrecognised argument (not defined in the schema) is passed in the user input.

unrecognisedCommand: "throw" | "into-positional"

What to do when an unrecognised command (not defined in the schema) is passed into the user input.

Generated using TypeDoc