@absolunet/ioc2.1.0

View on GitHub

CommandRepository

Command repository that stores all the register commands through the command registrar.

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['app', 'terminal', 'yargs'].

Methods

all(withPoliciesopt, groupedopt)

Source:
Get all commands. Can return either an array of commands or a dictionary associating groups of commands based on names.
Parameters:
Name Type Attributes Default Description
withPolicies boolean <optional>
true Use gate service to filter valid commands by policies.
grouped boolean <optional>
false Request grouped command result instead of a single array.
Returns:
The commands or the grouped commands.
Type
Array.<Command> | object.<string, Array.<Command>>

get(name)

Source:
Get command by name.
Parameters:
Name Type Description
name string The command name.
Returns:
The command instance, or null if not found.
Type
console.Command | null

has(name)

Source:
Check if command is registered.
Parameters:
Name Type Description
name string The command name.
Returns:
Indicates if the command exists.
Type
boolean

add(command)

Source:
Add given command in the command list.
Parameters:
Name Type Description
command function | console.Command The command class or instance.
Returns:
The current command repository instance.
Type
console.repositories.CommandRepository

makeCommand(command)

Source:
Make a command instance.
Parameters:
Name Type Description
command Command | function A command class.
Returns:
The command class instance.
Type
Command