diff --git a/docs/development/extension-hooks/extension-hooks-overview.md b/docs/development/extension-hooks/extension-hooks-overview.md index 7bac8c885..1218c498b 100644 --- a/docs/development/extension-hooks/extension-hooks-overview.md +++ b/docs/development/extension-hooks/extension-hooks-overview.md @@ -20,6 +20,7 @@ TIP: Reference [Extending The Core](development/extensions.md) for more informat Core hooks are categorized into 5 categories: - Global - [Core Library](development/extension-hooks/global/core.md) + - [CLI](development/extension-hooks/global/cli.md) - [Email Library](development/extension-hooks/global/email.md) - [Filemanager Library](development/extension-hooks/global/filemanager.md) - [Functions Library](development/extension-hooks/global/functions.md) diff --git a/docs/development/extension-hooks/global/cli.md b/docs/development/extension-hooks/global/cli.md new file mode 100644 index 000000000..f29d3ed25 --- /dev/null +++ b/docs/development/extension-hooks/global/cli.md @@ -0,0 +1,48 @@ +--- +lang: php +--- + + + +# CLI Extension Hooks + +### `cli_boot($cli)` + +| Parameter | Type | Description | +| ------------------ | -------- | ------------------------------------------------------------------------ | +| \$cli | `Object` | Instance of CLI currently running | +| Returns | `Void` | | + +Run tasks before every CLI request. + +How it's called: + + $command = ee()->extensions->call('cli_boot', $this); + if (ee()->extensions->end_script === true) { + $this->complete(''); + } + +### `cli_before_handle($cli, $commandClass, $command)` + +| Parameter | Type | Description | +| -------------- | -------- | ------------------------------------------------------------------------ | +| \$cli | `Object` | Instance of CLI currently running | +| \$commandClass | `String` | Class name of command to be executed | +| \$command | `Object` | Instance of command class to be executed | +| Returns | `Object` | Modified instance of `$command` | + +Run tasks right before CLI command is excuted. Allows modification of command class instance. + +How it's called: + + $command = ee()->extensions->call('cli_before_handle', $this, $commandClass, $command); + if (ee()->extensions->end_script === true) { + $this->complete(''); + }