KC's Workspace
    Preparing search index...
    Index

    Constructors

    Properties

    helpWidth?: number

    output helpWidth, long lines are wrapped to fit

    minWidthToWrap: number
    showGlobalOptions: boolean
    sortOptions: boolean
    sortSubcommands: boolean

    Methods

    • Get the argument description to show in the list of arguments.

      Parameters

      Returns string

    • Get the argument term to show in the list of arguments.

      Parameters

      Returns string

    • Wrap a string at whitespace, preserving existing line breaks. Wrapping is skipped if the width is less than minWidthToWrap.

      Parameters

      • str: string
      • width: number

      Returns string

    • Get the description for the command.

      Parameters

      Returns string

    • Get the command usage to be displayed at the top of the built-in help.

      Parameters

      Returns string

    • Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations.

      Parameters

      • str: string

      Returns number

    • Generate the built-in help text.

      Parameters

      Returns string

    • Format the "item", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.

      So "TTT", 5, "DDD DDDD DD DDD" might be formatted for this.helpWidth=17 like so: TTT DDD DDDD DD DDD

      Parameters

      • term: string
      • termWidth: number
      • description: string
      • helper: Help

      Returns string

    • Format a list of items, given a heading and an array of formatted items.

      Parameters

      • heading: string
      • items: string[]
      • helper: Help

      Returns string[]

    • Group items by their help group heading.

      Type Parameters

      Parameters

      • unsortedItems: T[]
      • visibleItems: T[]
      • getGroup: (item: T) => string

      Returns Map<string, T[]>

    • Get the longest argument term length.

      Parameters

      Returns number

    • Get the longest global option term length.

      Parameters

      Returns number

    • Get the longest option term length.

      Parameters

      Returns number

    • Get the longest command term length.

      Parameters

      Returns number

    • Get the option description to show in the list of options.

      Parameters

      Returns string

    • Get the option term to show in the list of options.

      Parameters

      Returns string

    • Calculate the pad width from the maximum term length.

      Parameters

      Returns number

    • Detect manually wrapped and indented strings by checking for line break followed by whitespace.

      Parameters

      • str: string

      Returns boolean

    • Parameters

      • contextOptions: { error?: boolean; helpWidth?: number; outputHasColors?: boolean }

      Returns void

    • Parameters

      • str: string

      Returns string

    • Parameters

      • str: string

      Returns string

    • Base style used in terms and usage for arguments.

      Parameters

      • str: string

      Returns string

    • Parameters

      • str: string

      Returns string

    • Style for command name in usage string.

      Parameters

      • str: string

      Returns string

    • Base style used by descriptions.

      Parameters

      • str: string

      Returns string

    • Parameters

      • str: string

      Returns string

    • Parameters

      • str: string

      Returns string

    • Base style used in terms and usage for options.

      Parameters

      • str: string

      Returns string

    • Parameters

      • str: string

      Returns string

    • Parameters

      • str: string

      Returns string

    • Base style used in terms and usage for subcommands.

      Parameters

      • str: string

      Returns string

    • Style the titles. Called with 'Usage:', 'Options:', etc.

      Parameters

      • title: string

      Returns string

    • Usage:

      Parameters

      • str: string

      Returns string

    • Get the command summary to show in the list of subcommands.

      Parameters

      Returns string

    • Get the command term to show in the list of subcommands.

      Parameters

      Returns string

    • Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.

      Parameters

      Returns Command[]

    • Get an array of the visible global options. (Not including help.)

      Parameters

      Returns Option[]

    • Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.

      Parameters

      Returns Option[]