Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AbstractCLICommand

Abstract CLI command construct
Extend this class to write your own commands

Hierarchy

  • AbstractCLICommand

Index

Constructors

constructor

Properties

Protected aliases

aliases: string | string[] = []

Command alias/es if applicable (alternative ways to invoke it)

Protected Readonly cliLogger

cliLogger: CLILogger

The CLI run logger

Protected Abstract command

command: string

The command name (this is the way to invoke it)

Protected Readonly completionPromise

completionPromise: IPendingPromise

The completion promise to invoke when done

Protected describe

describe: string | false | undefined

Command help text description

Methods

Protected Abstract buildCommandArgs

  • buildCommandArgs(args: Argv): Argv

Protected getArgsReport

  • Produces a string representation of the command arguments to be logged WARNING - if not overridden and adjusted, this may leak confidential data to the logs

    Parameters

    Returns string | undefined

    The string to report (return undefined to skip the report)

Protected Abstract handleCommand

Protected postCommand

  • postCommand(executionPhase: ExecutionPhase, executionError?: Error): Promise<void>
  • Run post-command teardown Will be called even if pre-command throws and the main command execution is skipped Thrown errors will fail the command

    Parameters

    • executionPhase: ExecutionPhase

      The current execution phase

    • Optional executionError: Error

      The error thrown by the command (if applicable)

    Returns Promise<void>

Protected preCommand

  • preCommand(): Promise<void>
  • Run pre-command setup Thrown errors will skip main command execution and fail the command

    Returns Promise<void>

toYargsCommand

  • toYargsCommand(): CommandModule

Generated using TypeDoc