Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ICommandDefinition

Interface describing the syntax and behavior definition of a command or group of commands

Hierarchy

  • ICommandDefinition

Indexable

[key: string]: any

Index signature

Index

Properties

Optional aliases

aliases: string[]

Aliases - any number of single or more character aliases can be specified.

memberof

ICommandDefinition

Optional chainedHandlers

chainedHandlers: IChainedHandlerEntry[]

Build this command from multiple handlers chained together, remapping the response to arguments for future handlers in the command.

Limitations of chained handlers include:

  • The syntax of the command for each handler is not validated, since the full definition is not provided
  • You can only map arguments from the "data" field of the command response, so whatever you need to pass to a future handler in the chain must be passed to response.data.setObj
memberof

ICommandDefinition

Optional children

children: ICommandDefinition[]

The Children for this command - used when the type is provider or group. Use the children to build complex nested syntaxes - however bright modules must follow the prescribed command syntax structure for Brightside.

memberof

ICommandDefinition

Optional customize

customize: any

The command handlers are passed the definition document for the command. You can place any additional "custom" definition information here.

memberof

ICommandDefinition

Optional deprecatedReplacement

deprecatedReplacement: string

If this property exists, the command is deprecated. The property value is a string that identifies the replacement command. It is used in a deprecation message similar to the following: This command is deprecated. Recommended replacement: value_of_deprecatedReplacement_goes_here

memberof

ICommandDefinition

description

description: string

The description - keep group descriptions "small" and include lengthier descriptions for "commands".

memberof

ICommandDefinition

Optional enableStdin

enableStdin: boolean

If true, stdin will automatically be read before the handler of this command is invoked.

memberof

ICommandDefinition

Optional examples

The set of examples displayed in the help for this command.

memberof

ICommandDefinition

Optional experimental

experimental: boolean

Is this command experimental? If you set this to true, the command will be marked with help text indicating that it is experimental. If this command is of type "group" all descendant commands will be marked experimental as well.

memberof

ICommandDefinition

Optional handler

handler: string

The handler for this command - this is a string literal that is used on the "require" statement to load the command handler - The handler itself must implement ICommandHandler. A string is used over an actual instance because we do not want the handler (and its required dependencies) to be loaded before it is issued.

memberof

ICommandDefinition

Optional mustSpecifyOne

mustSpecifyOne: string[]

Must specify one indicates that you must specify one of the options listed.

memberof

ICommandDefinition

name

name: string

The command or group name

memberof

ICommandDefinition

Optional onlyOneOf

onlyOneOf: string[]

Only one of the listed options can be specified

memberof

ICommandDefinition

Optional options

The options to be exposed on the command.

memberof

ICommandDefinition

Optional outputFormatOptions

outputFormatOptions: boolean

Enable output format options (e.g. "--response-format-type"). The output format options are applied to data that is presented to the handler response format APIs (see IHandlerResponseApi, "format" property). The intent of of the output format options:

  1. Simplify the code in a command handler. A "common" use-case for handler output is printing tables (or lists) of JSON objects/data OR a single JSON response object.

  2. Passing the data described in (1) to the handler response format API and enabling the format options gives the user full control over the output format. They can choose to output an array of JSON objects as a table OR a list of prettified objects. The use can also choose to include table headers and filter fields. The user can also reduce the output of a table to a single column (or a JSON object to a single property) eliminating the need to manually code options such as "--only-print-this-one-field"

See the "ICommandOutputFormat" JSDoc for details on the format types.

The options enabled:

--response-format-type [table|list|object|string]

Allows the user to control the output format of the data. See the "ICommandOutputFormat" interface for details.

--response-format-filter [array of fields]

Allows the user to include only the fields specified in the filter array.

--response-format-header [boolean]

Allows the user to optionally include the header with a table.

memberof

ICommandDefinition

Optional passOn

Pass on attributes of the current definition node to children

memberof

ICommandDefinition

Optional positionals

The positional arguments to be exposed on the command.

memberof

ICommandDefinition

Optional profile

Auto-loading of profile specifications - see the interface definition for more details.

memberof

ICommandDefinition

Optional stdinOptionDescription

stdinOptionDescription: string

The description for the stdin option - used if enableStdin is true

memberof

ICommandDefinition

Optional summary

summary: string

A shorter (~one line) description of your command

memberof

ICommandDefinition

type

This documents segment type - either "group" or "command". See the type definition for more detail.

memberof

ICommandDefinition

Generated using TypeDoc