Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommandProcessor

The command processor for imperative - accepts the command definition for the command being issued (and a pre-built) response object and validates syntax, loads profiles, instantiates handlers, & invokes the handlers.

export

Hierarchy

  • CommandProcessor

Index

Constructors

constructor

Properties

Private mCommandLine

mCommandLine: string

The command line.

memberof

CommandProcessor

Private mCommandRootName

mCommandRootName: string

The root command name of the CLI (specified in the Imperative Configuration document)

memberof

CommandProcessor

Private mDefinition

mDefinition: ICommandDefinition

The command definition node for the command being executed.

memberof

CommandProcessor

Private mEnvVariablePrefix

mEnvVariablePrefix: string

Environmental variable name prefix used to construct configuration environmental variables.

memberof

CommandProcessor

Private mFullDefinition

mFullDefinition: ICommandDefinition

The full command definition contains all parents/ancestors of the command being executed.

memberof

CommandProcessor

Private mHelpGenerator

mHelpGenerator: IHelpGenerator

The help generator to use - normally passed the default generator.

memberof

CommandProcessor

Private mLogger

mLogger: Logger = Logger.getImperativeLogger()

Imperative Logger instance for logging from the command processor.

memberof

CommandProcessor

Private mProfileManagerFactory

The profile manager to use when loading profiles for commands

memberof

CommandProcessor

Private mPromptPhrase

mPromptPhrase: string

The phrase used to indicate the user wants to enter the value of an argument in a hidden text prompt

memberof

CommandProcessor

Static Private Readonly ERROR_TAG

ERROR_TAG: string = "Command Processor Error:"

The error tag for imperative errors.

static
memberof

CommandProcessor

Accessors

commandLine

  • get commandLine(): string

definition

envVariablePrefix

  • get envVariablePrefix(): string

fullDefinition

helpGenerator

Private log

profileFactory

promptPhrase

  • get promptPhrase(): string

rootCommand

  • get rootCommand(): string

Methods

Private attemptHandlerLoad

Private constructResponseObject

Private finishResponse

Private handleHandlerError

  • handleHandlerError(handlerErr: Error | string, response: CommandResponse, handlerPath: string): void

help

Private invalidSyntaxNotification

invoke

  • Invoke the command handler. Locates and requires the module specified by the command definition document, creates a new object, creates a response object, and invokes the handler. The handler is responsible for fulfilling the promise when complete.

    Parameters

    Returns Promise<ICommandResponse>

    • The promise that is fulfilled. A rejection if the promise indicates a truly exceptional condition (should not occur).

Private prepare

validate

webHelp

Generated using TypeDoc