Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CLI

The CLI
Extend this to add functionality and customization

Hierarchy

  • CLI

Index

Constructors

constructor

Properties

Protected Readonly cliInitOptions

cliInitOptions: ICLIInitOptions

The initialization options for this CLI

Protected cliLogger

cliLogger: ICLILogger

The logger to be used by this CLI

Accessors

runID

  • get runID(): string
  • The unique run ID this CLI is executing
    A process can have only one CLI execution at a time

    Returns string

Methods

Protected addSharedOptions

  • addSharedOptions(args: Argv): Argv
  • Override this to add shared args, options, middleware, or modify yargs parser configuration
    (you can do almost anything specified in yargs API

    Parameters

    • args: Argv

      The current args

    Returns Argv

    The updated args

Protected getCommandFilesPaths

  • getCommandFilesPaths(): string[]
  • Returns a list of command file paths to load to the parser
    Defaults to .ts/.js files in the {@link cliInitOptions.commandsDir} path (excluding ones starting with abstract)
    Override this to implement your own filtering scheme

    Returns string[]

Private getCommands

Private getInitOptions

  • Builds the full init options from the user's partial options and the default options

    Parameters

    Returns ICLIInitOptions

    The full init options

Private getPendingPromise

  • Creates a completion promise to be used by the CLI commands
    This is needed since yargs doesn't fully support async parsing (See issue 1420 for details)

    Returns IPendingPromise

    The completion promise

Private initLogger

  • initLogger(): void
  • Initialize logger engine (if needed)

    Returns void

Protected loadSettingsFile

  • loadSettingsFile(args: Arguments<{ settingsFile?: undefined | string }>): any
  • Provide cli arguments via a json settings file
    Called automatically by runFromArgs

    internal

    Parameters

    • args: Arguments<{ settingsFile?: undefined | string }>

      The pre-parsed arguments object

    Returns any

runFromArgs

  • runFromArgs(args?: string[]): Promise<any>
  • Execute the CLI for a given set of arguments

    Parameters

    • Default value args: string[] = process.argv.slice(2)

      A preprocessed set of arguments or the process run arguments

    Returns Promise<any>

Generated using TypeDoc