Class CommandAbstract

Base class for all commands, including subcommands. Any user implemented command must extend from this class.

Hierarchy

  • Command

Constructors

Properties

Methods

Constructors

Properties

_subcommands: Record<string, InternalCommand> = {}
args: (<T>(parser: Args<T>) => Args<any>)

Type declaration

    • <T>(parser: Args<T>): Args<any>
    • Type Parameters

      • T extends {}

      Parameters

      Returns Args<any>

run: ((args: any) => Promise<unknown>)

Type declaration

    • (args: any): Promise<unknown>
    • Parameters

      • args: any

      Returns Promise<unknown>

Methods

  • Creates a runner function for use with run. This exists to provide type inference to the callback, which is not available without a function call.

    Returns

    • the run implementation

    Parameters

    • runFn: ((args: any) => Promise<unknown>)

      the run function

        • (args: any): Promise<unknown>
        • Parameters

          • args: any

          Returns Promise<unknown>

    Returns ((args: any) => Promise<unknown>)

      • (args: any): Promise<unknown>
      • Creates a runner function for use with run. This exists to provide type inference to the callback, which is not available without a function call.

        Returns

        • the run implementation

        Parameters

        • args: any

        Returns Promise<unknown>

  • Register a subcommand with this command. This will setup the parser and load the defition into the base parser.

    Returns

    this

    Parameters

    • param0: [string, ...string[]]

      the name and (optional) aliases of the subcommand

    • subcommand: Command

      the subcommand definition

    Returns Command

Generated using TypeDoc