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 mConfig

mConfig: Config

Config object used to load profiles from active config layers.

memberof

CommandProcessor

Private Optional mDaemonContext

mDaemonContext: IDaemonContext

The context object defined when in daemon mode.

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 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 ENV_SHOW_SECURE_SUFFIX

ENV_SHOW_SECURE_SUFFIX: "_SHOW_SECURE_ARGS" = `_SHOW_SECURE_ARGS`

Show secure fields in the output of the command ENV var suffix

static
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

config

definition

envVariablePrefix

  • get envVariablePrefix(): string

fullDefinition

helpGenerator

Private log

promptPhrase

  • get promptPhrase(): string

rootCommand

  • get rootCommand(): string

Methods

Private attemptHandlerLoad

Private constructResponseObject

Private finishResponse

Private getStdinStream

  • getStdinStream(): stream.Readable
  • Get stdin stream for the command handler to use. In daemon mode this is a stream of data received from the daemon client. Otherwise it defaults to process.stdin.

    Returns stream.Readable

    Readable stream containing stdin data

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

Private showInputsOnly

validate

webHelp

Generated using TypeDoc