Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StringArgument

Hierarchy

Index

Properties

Private lowercase

lowercase: boolean = false

Private maxlen

maxlen: number | null = null

Private minlen

minlen: number | null = null

Private regex

regex: RegExp | null = null

Private uppercase

uppercase: boolean = false

Private whitelist

whitelist: string[] | null = null

Methods

Protected _validate

  • _validate(arg: string, ...rest: string[]): string[]
  • Validates the given string to the StringArgument params

    Parameters

    • arg: string

      string argument that should be parsed

    • Rest ...rest: string[]

      the remaining args

    Returns string[]

allow

  • allow(words: string[]): this

forceLowerCase

  • forceLowerCase(): this

forceUpperCase

  • forceUpperCase(): this

getDefault

  • getDefault(): any

getManual

  • getManual(): string

getName

  • getName(): string

hasDefault

  • hasDefault(): boolean

isOptional

  • isOptional(): boolean

match

  • match(regex: RegExp): this

maximum

  • maximum(len: number): this

minimum

  • minimum(len: number): this

name

  • name(name: string, display?: undefined | string): this
  • Sets a name for the argument to identify it later when the command gets dispatched This name will be used when passing the parsed argument to the exec function

    Parameters

    • name: string

      sets the name of the argument

    • Optional display: undefined | string

      sets a beautified display name which will be used when the getManual command gets executed, if none given it will use the first parameter as display value

    Returns this

optional

  • optional(fallback?: any, displayDefault?: boolean): this
  • Sets an Argument as optional if the argument has not been parsed successful it will use the first argument which has been given inside this method

    Parameters

    • Optional fallback: any

      the default value which should be set if this parameter has not been found

    • Default value displayDefault: boolean = true

      wether it should display the default value when called with the #getUsage method

    Returns this

validate

  • validate(args: string): string[]

Generated using TypeDoc