#cp.commands
Commands Module.
#Submodules
#API Overview
Constants - Useful values which cannot be changed
Functions - API calls offered directly by the extension
Fields - Variables which can only be accessed from an object returned by a constructor
Methods - API calls which can only be made on an object returned by a constructor
#API Documentation
#Constants
Signature | cp.commands.DEFAULT_EXTENSION -> string |
Type | Constant |
Description | The menubar position priority. |
Notes | None |
Source | src/extensions/cp/commands/init.lua line 33 |
#Functions
Signature | cp.commands.getShortcutsPath(name) -> string |
Type | Function |
Description | Returns the path to the named shortcut set. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 379 |
Signature | cp.commands.group(id) -> cp.command or nil |
Type | Function |
Description | Creates a collection of commands. These commands can be enabled or disabled as a group. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 57 |
Signature | cp.commands.groupIds() -> table |
Type | Function |
Description | Returns an array of IDs of command groups which have been created. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 40 |
Signature | cp.commands.groups(id) -> table of cp.commands |
Type | Function |
Description | Returns a table with the set of commands. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 70 |
Signature | cp.commands.loadFromFile(name) -> boolean |
Type | Function |
Description | Loads a shortcut set from the standard location with the specified name. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 404 |
Signature | cp.commands.new(id) -> cp.commands |
Type | Function |
Description | Creates a collection of commands. These commands can be enabled or disabled as a group. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 83 |
Signature | cp.commands.saveToFile(name) -> boolean |
Type | Function |
Description | Saves the current shortcuts for all groups to a file in the standard location with the provided name. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 456 |
#Fields
Signature | cp.commands.enabled <cp.prop: boolean> |
Type | Field |
Description | If enabled, the commands in the group will be active as well. |
Notes | None |
Source | src/extensions/cp/commands/init.lua line 104 |
Signature | cp.commands.isEditable <cp.prop: boolean> |
Type | Field |
Description | If set to false , the command group is not user-editable. |
Notes | None |
Source | src/extensions/cp/commands/init.lua line 116 |
#Methods
Signature | cp.commands:activate(successFn, failureFn) -> nil |
Type | Method |
Description | Will trigger an 'activate' event, and then execute either the successFn or failureFn if the command group is not enabled within 5 seconds. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 300 |
Signature | cp.commands:add(commandId) -> cp.commands.command |
Type | Method |
Description | Adds a new command with the specified ID to this group. Additional configuration should be applied to the returned command instance. Eg: |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/commands/init.lua line 139 |
Signature | cp.commands:clear() -> cp.commands |
Type | Method |
Description | Clears all commands and their shortcuts. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 197 |
Signature | cp.commands:deleteShortcuts() -> cp.commands |
Type | Method |
Description | Clears all shortcuts associated with commands in this command group. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 212 |
Signature | cp.commands:disable() -> cp.commands |
Type | Method |
Description | Disables the command group. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 242 |
Signature | cp.commands:enable() -> cp.commands |
Type | Method |
Description | Enables the command group. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 228 |
Signature | cp.commands:get(commandId) -> cp.commands.command |
Type | Method |
Description | Returns the command with the specified ID, or nil if none exists. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 162 |
Signature | cp.commands:getAll() -> table of cp.commands.command |
Type | Method |
Description | Returns the table of commands, with the key being the ID and the value being the command instance. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/commands/init.lua line 175 |
Signature | cp.commands:id() -> string |
Type | Method |
Description | Returns the unique ID of the command group. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 126 |
Signature | cp.commands:loadShortcuts(data) -> nil |
Type | Method |
Description | Loads the shortcut details in the data table and applies them to the commands in this group. The data should probably come from the saveShortcuts method. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 358 |
Signature | cp.commands:saveShortcuts() -> table |
Type | Method |
Description | Returns a table that is approprate to be saved to file that contains the shortuct for all contained cp.commands.command instances. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/commands/init.lua line 333 |
Signature | cp.commands:watch(events) -> cp.commands |
Type | Method |
Description | Adds an event watcher to the command group. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/commands/init.lua line 256 |