Creates an instance of CommandResponse.
See the interface for details.
The arguments passed to the command - may be undefined/null
API instance for the console APIs - used to write messages to stdout/stderr.
The full set of control parameters for the response - see the interface for details.
The "data" object that is placed on the JSON response object of the command
API instance for the data APIs - used to populate the JSON response object fields.
The command definition document - may be undefined/null
The error object appended to the JSON response to the command - automatically added if the handler rejects the promise.
Command handler exit code. Will be used when exiting the process at the end of command execution
Format APIs for automatically formatting output data
The message placed on the response object when the JSON response is built
The default highlight color for chalk
API instance for the progress bar - used to create/end command progress bars.
Progress bar instance - only one can be present at any given time.
The progress bar spinner chars.
The command response format - JSON, default, etc.
Enable silent mode - means absolutely NO output will be written to the console/terminal.
The stderr buffer - collects all messages sent to stderr.
The stdout buffer - collects all messages sent to stdout.
The stream to write to in daemon mode
Command handler succeeded flag - true if the command succeeded.
Max column width for formulating tabular output
Imperative Error tag for error messaging
Accessor for the console API - Handlers will use this API to write console messages.
Internal accessor for the full control parameters passed to the command response object.
Accessor for the data api class - Handlers will use this to construct/influence the response JSON object (data is only displayed to the user if JSON mode is requested).
Accessor for the progress bar API - Handlers will use this API to create/destroy command progress bars.
Accessor for the response format - see the type for available options - controls how the response will be presented to the user (JSON format, default, etc.)
Accessor for the silent flag - silent indicates that the command produces absolutely no output to the console.
Buffer the message (string or buffer) to the stderr buffer. Used to accumulate messages for different reasons (JSON mode is enabled, etc.).
The data/messages to buffer.
Buffer the message (string or buffer) to the stdout buffer. Used to accumulate messages for different reasons (JSON mode is enabled, etc.).
The data/messages to buffer.
Returns the JSON response for the command.
Complete any outstanding progress bars.
Explicitly end a stream
Setter for the succeeded flag (sets to false to indicate command failure).
Uses text utils to format the message (format strings).
The format message
The substitution values for the format string
Send headers to daemon client
Setter for the error object in the response - automatically populated by the Command Processor if the handler rejects the handler promise.
The error object to place in the response.
Setter for the succeeded flag (sets to true to indicate command success).
Indicates if output should be written immediately to the console/terminal. If silent mode is true or response format indicates JSON, then write() will return false.
Buffers to stderr and optionally prints the msg to the console.
The data to write/buffer
Buffers to stdout and optionally prints the msg to the console.
The data to write/buffer
Writes the JSON response to the console - Done normally by the command processor dependending on the response format specified in the object.
Writes the data to stderr
the data to write to stderr
Writes the data to stdout
the data to write
Writes data to stream if provided (for daemon mode)
Generated using TypeDoc
Command response object allocated by the command processor and used to construct the handler response object passed to the command handlers. The response object contains all the methods necessary for a command handler (and the processor) to formulate a command response. Controls buffering of messages and JSON response formats.
Instances of this class are only manipulated by the command processor. See "HandlerResponse" for the handler response object.
{ICommandResponseApi}