Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Option

Models command line options. Options are values passed to a command line interface using -x or --x. Supported syntaxes depend on the parser.

Short name is generally used with a single dash, while long name requires a double-dash.

Hierarchy

  • Option

Index

Constructors

constructor

  • Returns Option

  • Parameters

    Returns Option

Methods

addChoice

  • addChoice(choices: string): Option
  • Sets the list of values accepted by this option. If the value set by the user does not match once of these values, a {@link InvalidValueException} exception is thrown.

    Parameters

    • choices: string

    Returns Option

getArgName

  • getArgName(): string
  • Sets te arg name for this option.

    Returns string

getChoices

  • getChoices(): string[]
  • Sets the list of values accepted by this option. If the value set by the user does not match once of these values, a {@link InvalidValueException} exception is thrown.

    Returns string[]

getDefaultValue

  • getDefaultValue(): string
  • Sets the default value of this option

    Returns string

getDescription

  • getDescription(): string
  • Sets te description of this option.

    Returns string

getLongName

  • getLongName(): string
  • Sets the long name of this option.

    Returns string

getName

  • getName(): string
  • Returns string

getShortName

  • getShortName(): string
  • Sets the short name of this option.

    Returns string

isFlag

  • isFlag(): boolean
  • Configures the current Option to be a flag. It will be evaluated to true if it's found in the command line. If you need a flag that may receive a value, use, in this order:

      option.setFlag(true).setSingleValued(true)
    

    Returns boolean

isHelp

  • isHelp(): boolean
  • Sets whether or not this option is a "help" option

    Returns boolean

isHidden

  • isHidden(): boolean
  • Sets whether or not this option should be hidden

    Returns boolean

isMultiValued

  • isMultiValued(): boolean
  • Sets whether or not this option can receive several values.

    Returns boolean

isRequired

  • isRequired(): boolean
  • Sets whether or not this option is mandatory.

    Returns boolean

isSingleValued

  • isSingleValued(): boolean
  • Sets whether or not this option can receive a value.

    Returns boolean

setArgName

  • setArgName(argName: string): Option
  • Sets te arg name for this option.

    Parameters

    • argName: string

    Returns Option

setChoices

  • setChoices(choices: string[]): Option
  • Sets the list of values accepted by this option. If the value set by the user does not match once of these values, a {@link InvalidValueException} exception is thrown.

    Parameters

    • choices: string[]

    Returns Option

setDefaultValue

  • setDefaultValue(defaultValue: string): Option
  • Sets the default value of this option

    Parameters

    • defaultValue: string

    Returns Option

setDescription

  • setDescription(description: string): Option
  • Sets te description of this option.

    Parameters

    • description: string

    Returns Option

setFlag

  • setFlag(flag: boolean): Option
  • Configures the current Option to be a flag. It will be evaluated to true if it's found in the command line. If you need a flag that may receive a value, use, in this order:

      option.setFlag(true).setSingleValued(true)
    

    Parameters

    • flag: boolean

    Returns Option

setHelp

  • setHelp(help: boolean): Option
  • Sets whether or not this option is a "help" option

    Parameters

    • help: boolean

    Returns Option

setHidden

  • setHidden(hidden: boolean): Option
  • Sets whether or not this option should be hidden

    Parameters

    • hidden: boolean

    Returns Option

setLongName

  • setLongName(longName: string): Option
  • Sets the long name of this option.

    Parameters

    • longName: string

    Returns Option

setMultiValued

  • setMultiValued(multiValued: boolean): Option
  • Sets whether or not this option can receive several values.

    Parameters

    • multiValued: boolean

    Returns Option

setRequired

  • setRequired(required: boolean): Option
  • Sets whether or not this option is mandatory.

    Parameters

    • required: boolean

    Returns Option

setShortName

  • setShortName(shortName: string): Option
  • Sets the short name of this option.

    Parameters

    • shortName: string

    Returns Option

setSingleValued

  • setSingleValued(singleValued: boolean): Option
  • Sets whether or not this option can receive a value.

    Parameters

    • singleValued: boolean

    Returns Option

toJson

  • toJson(): {}
  • Returns {}

    • [key: string]: any

Generated using TypeDoc