Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Options

Hierarchy

  • Options

Index

Properties

Optional alias

alias: undefined | {}

An object representing the set of aliases for a key: { alias: { foo: ['f']} }.

Optional array

array: string[] | Array<{ boolean?: undefined | false | true; key: string; number?: undefined | false | true }>

Indicate that keys should be parsed as an array: { array: ['foo', 'bar'] }. Indicate that keys should be parsed as an array and coerced to booleans / numbers: { array: [ { key: 'foo', boolean: true }, {key: 'bar', number: true} ] }`.

Optional boolean

boolean: string[]

Arguments should be parsed as booleans: { boolean: ['x', 'y'] }.

Optional coerce

coerce: undefined | {}

Provide a custom synchronous function that returns a coerced value from the argument provided (or throws an error), e.g. { coerce: { foo: function (arg) { return modifiedArg } } }.

Optional config

config: string | string[] | {}

Indicate a key that represents a path to a configuration file (this file will be loaded and parsed).

Optional configuration

configuration: Partial<Configuration>

Provide configuration options to the yargs-parser.

Optional count

count: string[]

Indicate a key that should be used as a counter, e.g., -vvv = {v: 3}.

Optional default

default: undefined | {}

Provide default values for keys: { default: { x: 33, y: 'hello world!' } }.

Optional envPrefix

envPrefix: undefined | string

Environment variables (process.env) with the prefix provided should be parsed.

Optional narg

narg: undefined | {}

Specify that a key requires n arguments: { narg: {x: 2} }.

Optional normalize

normalize: string[]

path.normalize() will be applied to values set to this key.

Optional number

number: string[]

Keys should be treated as numbers.

Optional string

string: string[]

Keys should be treated as strings (even if they resemble a number -x 33).