|
| 1 | +--- |
| 2 | +lang: php |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- |
| 6 | + This source file is part of the open source project |
| 7 | + ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide) |
| 8 | +
|
| 9 | + @link https://expressionengine.com/ |
| 10 | + @copyright Copyright (c) 2003-2020, Packet Tide, LLC (https://packettide.com) |
| 11 | + @license https://expressionengine.com/license Licensed under Apache License, Version 2.0 |
| 12 | +--> |
| 13 | + |
| 14 | +# CLI Extension Hooks |
| 15 | + |
| 16 | +### `cli_boot($cli)` |
| 17 | + |
| 18 | +| Parameter | Type | Description | |
| 19 | +| ------------------ | -------- | ------------------------------------------------------------------------ | |
| 20 | +| \$cli | `Object` | Instance of CLI currently running | |
| 21 | +| Returns | `Void` | | |
| 22 | + |
| 23 | +Run tasks before every CLI request. |
| 24 | + |
| 25 | +How it's called: |
| 26 | + |
| 27 | + $command = ee()->extensions->call('cli_boot', $this); |
| 28 | + if (ee()->extensions->end_script === true) { |
| 29 | + $this->complete(''); |
| 30 | + } |
| 31 | + |
| 32 | +### `cli_before_handle($cli, $commandClass, $command)` |
| 33 | + |
| 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` | |
| 40 | + |
| 41 | +Run tasks right before CLI command is excuted. Allows modification of command class instance. |
| 42 | + |
| 43 | +How it's called: |
| 44 | + |
| 45 | + $command = ee()->extensions->call('cli_before_handle', $this, $commandClass, $command); |
| 46 | + if (ee()->extensions->end_script === true) { |
| 47 | + $this->complete(''); |
| 48 | + } |
0 commit comments