Skip to main content

Class: MassargHelpFlag

option.MassargHelpFlag

A flag that can be passed to a command to show the help message.

Hierarchy

Constructors

constructor

new MassargHelpFlag(config?): MassargHelpFlag

Parameters

NameType
configPartial<Omit<{ name: string ; description: string ; aliases: string[] ; defaultValue?: any ; array?: boolean ; required?: boolean ; isDefault?: boolean ; hidden?: boolean ; outputName?: string ; parse?: Parser<ArgsObject, boolean> }, "parse">>

Returns

MassargHelpFlag

Overrides

MassargFlag.constructor

Defined in

src/option.ts:429

Properties

negatable

negatable: boolean

Whether this flag may be negated using negationName or negationAliases.

Inherited from

MassargFlag.negatable

Defined in

src/option.ts:361


negationName

negationName: string

The negation name of this flag, which can be used with the full option notation.

Inherited from

MassargFlag.negationName

Defined in

src/option.ts:363


negationAliases

negationAliases: string[]

The negation aliases of this flag, which can be used with the shorthand option notation.

Inherited from

MassargFlag.negationAliases

Defined in

src/option.ts:365


name

name: string

Inherited from

MassargFlag.name

Defined in

src/option.ts:177


description

description: string

Inherited from

MassargFlag.description

Defined in

src/option.ts:178


defaultValue

Optional defaultValue: boolean

Inherited from

MassargFlag.defaultValue

Defined in

src/option.ts:179


aliases

aliases: string[]

Inherited from

MassargFlag.aliases

Defined in

src/option.ts:180


parse

parse: Parser<ArgsObject, boolean>

Inherited from

MassargFlag.parse

Defined in

src/option.ts:181


isArray

isArray: boolean

Whether this option can be used multiple times. Any passed values will end up in an array instead of each usage overwriting the existing value.

Inherited from

MassargFlag.isArray

Defined in

src/option.ts:186


isRequired

isRequired: boolean

Whether this option is required. Failing to specify this option will throw an error.

Inherited from

MassargFlag.isRequired

Defined in

src/option.ts:188


isDefault

isDefault: boolean

Inherited from

MassargFlag.isDefault

Defined in

src/option.ts:189


outputName

Optional outputName: string

Inherited from

MassargFlag.outputName

Defined in

src/option.ts:190

Methods

fromTypedConfig

fromTypedConfig<T, A>(config): MassargOption<T, ArgsObject>

Create a typed option from a configuration. Currently supports number options which are automatically transformed from string to number.

Type parameters

NameType
Tunknown
Aextends ArgsObject = ArgsObject

Parameters

NameType
configObject
config.namestring
config.descriptionstring
config.aliasesstring[]
config.typeundefined | "number"
config.defaultValueany
config.arrayundefined | boolean
config.requiredundefined | boolean
config.isDefaultundefined | boolean
config.hiddenundefined | boolean
config.outputNameundefined | string
config.parseundefined | Parser<A, T>

Returns

MassargOption<T, ArgsObject>

Inherited from

MassargFlag.fromTypedConfig

Defined in

src/option.ts:209


parseDetails

parseDetails(argv, _options, prefixes): ArgvValue<boolean>

Parameters

NameType
argvstring[]
_optionsArgsObject
prefixesPrefixes

Returns

ArgvValue<boolean>

Inherited from

MassargFlag.parseDetails

Defined in

src/option.ts:377


qualifiedNames

qualifiedNames(prefixes): QualifiedNames

Return the finalized names that will cause this option to match.

Parameters

NameType
prefixesPrefixes

Returns

QualifiedNames

Inherited from

MassargFlag.qualifiedNames

Defined in

src/option.ts:418


getOutputName

getOutputName(): string

Returns the key which this option outputs to in the final object.

Returns

string

Default

The camelCase version of this option's name.

Can be overridden with {@link outputName}.

Inherited from

MassargFlag.getOutputName

Defined in

src/option.ts:226


helpString

helpString(): string

Get the help string for this option

Returns

string

Inherited from

MassargFlag.helpString

Defined in

src/option.ts:260


isMatch

isMatch(arg, prefixes): boolean

Returns true if the flag (including any prefixes) matches the name or aliases

Parameters

NameType
argstring
prefixesPrefixes

Returns

boolean

Inherited from

MassargFlag.isMatch

Defined in

src/option.ts:266