Class ConsoleService

Hierarchy

  • ConsoleService

Constructors

Properties

cli: Command

The root cli

commands: Map<string, Command> = ...

A Map holding group commands by name

container?: INestApplicationContext

An optional instance of the application. Required to scan the application

responseListener: EventEmitter = ...

Methods

  • Create a Command

    Parameters

    • options: CreateCommandOptions

      The options to create the commands

    • handler: CommandActionHandler

      The handler of the command

    • parent: Command

      The command to use as a parent

    • Optional commanderOptions: CommandOptions

    Returns Command

  • Create a group of command.

    Parameters

    • options: CreateCommandOptions

      The options to create the grouped command

    • parent: Command

      The command to use as a parent

    Returns Command

    Throws

    an error if the parent command contains explicit arguments, only simple commands are allowed (no spaces)

  • Get a cli

    Parameters

    • Optional name: string

      Get a cli by name, if not set, the root cli is used

    Returns undefined | Command

  • Get the full name of a command (parents names + command names separated by dot)

    Parameters

    • command: Command

    Returns string

  • Get the container

    Returns undefined | INestApplicationContext

  • Get the root cli

    Returns Command

  • Execute the cli

    Parameters

    • argv: string[]

    Returns Promise<CommandResponse>

  • Reset the cli stack (for testing purpose only)

    Returns void

  • Parameters

    • Optional name: string

    Returns Command

  • Wrap an action handler to work with promise.

    Parameters

    • action: CommandActionHandler

    Returns CommandActionWrapper