registerCommands

This is a special method whitch allows you to register your own commands from Event Listener. You can create commands for webconsole and for CLI mode.
This method is calling at Skynet start and all of available in webconsole select list commands and commands whitch are displayed in CLI when you viewing help are defined here.

In this method you must define two arrays:

$cli = [];

$console = [];


And you must return this arrays as below:

return array('cli' => $cli, 'console' => $console);

In $cli array you can define command for CLI mode, in $console array you can define commands for HTML webconsole.
You can create multiple commands, let's see an example:

$cli[] = ['-debug', '', 'Displays connections full debug'];
$cli[] = ['-dbg', '', 'Displays connections full debug (alias)'];
$cli[] = ['-cfg', '', 'Displays configuration'];

Syntax is here:

$cli[] = ['-COMMAND_NAME', 'POSSIBLE_PARAMS', 'DESCRIPTION'];

where POSSIBLE_PARAMS can be string for single param or array for multiple params.
If POSSIBLE_PARAMS are empty then params will not be shown in CLI.

When creating command for webconsole use syntax:

$console[] = ['@COMMAND_NAME', 'POSSIBLE_PARAMS', 'DESCRIPTION'];

Definition is similary to $cli expects prefix.

Example:
/src/SkynetUser/MyListener.php
public function registerCommands()
{
$cli = [];
$console = [];

$cli[] = ['-foo', '', 'bar'];
$cli[] = ['-foo2', 'param1', 'bar2'];
$cli[] = ['-foo3', array('param1', 'param2'), 'bar3'];

$console[] = ['@foo', '', 'bar'];
$console[] = ['@foo2', 'param1', 'bar2'];
$console[] = ['@foo3', array('param1', 'param2'), 'bar3'];

return array('cli' => $cli, 'console' => $console);
}
Full API Documentation is included in Skynet packages available on GitHub.