Skip to content

Commit 7f52544

Browse files
authored
Update cli.md
1 parent 9787367 commit 7f52544

File tree

1 file changed

+14
-22
lines changed
  • docs/development/extension-hooks/global

1 file changed

+14
-22
lines changed

docs/development/extension-hooks/global/cli.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,31 @@ lang: php
1818
| Parameter | Type | Description |
1919
| ------------------ | -------- | ------------------------------------------------------------------------ |
2020
| \$cli | `Object` | Instance of CLI currently running |
21-
| \$commandClassName | `String` | Class name of command to be executed |
22-
| \$commandObject | `Object` | Instance of command class to be executed |
23-
| Returns | `Object` | Modified instance of `$commandObject` |
21+
| Returns | `Void` | |
2422

25-
Run tasks on every CLI request. Allows running the code before certain CLI command is run as well as modification of command class instance.
23+
Run tasks on every CLI request. Allows running the code before certain CLI command.
2624

2725
How it's called:
2826

29-
$command = ee()->extensions->call('cli_boot', $this, $commandClass, $command);
27+
$command = ee()->extensions->call('cli_boot', $this);
3028
if (ee()->extensions->end_script === true) {
3129
$this->complete('');
3230
}
3331

34-
### `core_template_route($uri_string)`
32+
### `cli_before_handle($cli, $command, $commandClass)`
3533

36-
| Parameter | Type | Description |
37-
| ------------ | -------- | ------------------------------------------------------------------------ |
38-
| \$uri_string | `String` | Current URI string |
39-
| Returns | `Array` | Array containing the name of the template group and template (see below) |
34+
| Parameter | Type | Description |
35+
| -------------- | -------- | ------------------------------------------------------------------------ |
36+
| \$cli | `Object` | Instance of CLI currently running |
37+
| \$commandClass | `String` | Class name of command to be executed |
38+
| \$command | `Object` | Instance of command class to be executed |
39+
| Returns | `Object` | Modified instance of `$command` |
4040

41-
Reassign the template group and template loaded for parsing.
41+
Run tasks right before CLI command is excuted. Allows modification of command class instance.
4242

4343
How it's called:
4444

45-
$edata = ee()->extensions->call('core_template_route', ee()->uri->uri_string);
46-
if (is_array($edata) && count($edata) == 2)
47-
{
48-
list($template_group, $template) = $edata;
45+
$command = ee()->extensions->call('cli_before_handle', $this, $command, $commandClass);
46+
if (ee()->extensions->end_script === true) {
47+
$this->complete('');
4948
}
50-
51-
Example of array to return:
52-
53-
array(
54-
'template_group', // Template group name
55-
'template' // Template name
56-
);

0 commit comments

Comments
 (0)