cac
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Properties

aliasNames

aliasNames: string[]

args

args: CommandArg[]

cli

cli: CAC

Optional commandAction

commandAction: undefined | function

config

description

description: string

examples

examples: CommandExample[]

Optional globalCommand

globalCommand: GlobalCommand

Optional helpCallback

helpCallback: HelpCallback

name

name: string

options

options: Option[]

rawName

rawName: string

Optional usageText

usageText: undefined | string

Optional versionNumber

versionNumber: undefined | string

Accessors

isDefaultCommand

isDefaultCommand:

isGlobalCommand

isGlobalCommand:

Methods

action

  • action(callback: function): this
  • Parameters

    • callback: function
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns this

alias

  • alias(name: string): this
  • Parameters

    • name: string

    Returns this

allowUnknownOptions

  • allowUnknownOptions(): this

checkOptionValue

  • checkOptionValue(): void
  • Check if the required string-type options exist

    Returns void

checkRequiredArgs

  • checkRequiredArgs(): void

checkUnknownOptions

  • checkUnknownOptions(): void
  • Check if the parsed options contain any unknown options

    Exit and output error when true

    Returns void

example

hasOption

  • hasOption(name: string): undefined | Option
  • Check if an option is registered in this command

    Parameters

    • name: string

      Option name

    Returns undefined | Option

ignoreOptionDefaultValue

  • ignoreOptionDefaultValue(): this

isMatched

  • isMatched(name: string): boolean
  • Check if a command name is matched by this command

    Parameters

    • name: string

      Command name

    Returns boolean

option

  • option(rawName: string, description: string, config?: OptionConfig): this
  • Add a option for this command

    Parameters

    • rawName: string

      Raw option name(s)

    • description: string

      Option description

    • Optional config: OptionConfig

      Option config

    Returns this

outputHelp

  • outputHelp(): void

outputVersion

  • outputVersion(): void

usage

  • usage(text: string): this
  • Parameters

    • text: string

    Returns this

version

  • version(version: string, customFlags?: string): this
  • Parameters

    • version: string
    • Default value customFlags: string = "-v, --version"

    Returns this

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc