Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Argument

Index

Constructors

  • new Argument(arg: string, description?: string): Argument
  • Initialize a new command argument with the given name and description. The default is that the argument is required, and you can explicitly indicate this with <> around the name. Put [] around the name for an optional argument.

    Parameters

    • arg: string
    • Optional description: string

    Returns Argument

Properties

description: string
required: boolean
variadic: boolean

Methods

  • Make argument optional.

    Returns Argument

  • argParser<T>(fn: (value: string, previous: T) => T): Argument
  • Set the custom handler for processing CLI command arguments into argument values.

    Type parameters

    • T

    Parameters

    • fn: (value: string, previous: T) => T
        • (value: string, previous: T): T
        • Parameters

          • value: string
          • previous: T

          Returns T

    Returns Argument

  • Make argument required.

    Returns Argument

  • choices(values: readonly string[]): Argument
  • Only allow argument value to be one of choices.

    Parameters

    • values: readonly string[]

    Returns Argument

  • default(value: unknown, description?: string): Argument
  • Set the default value, and optionally supply the description to be displayed in the help.

    Parameters

    • value: unknown
    • Optional description: string

    Returns Argument

  • name(): string
  • Return argument name.

    Returns string

Generated using TypeDoc