Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
48 changes: 48 additions & 0 deletions docs/development/extension-hooks/global/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
lang: php
---

<!--
This source file is part of the open source project
ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide)

@link https://expressionengine.com/
@copyright Copyright (c) 2003-2020, Packet Tide, LLC (https://packettide.com)
@license https://expressionengine.com/license Licensed under Apache License, Version 2.0
-->

# 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('');
}