Skip to content

Commit 8966a5a

Browse files
committed
- Update Function Hooks to mention command_line array
1 parent 2c86424 commit 8966a5a

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/advanced/hooks.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,26 @@ own code. To use a hook, simply create one of the files listed below in your
1313
Run `bashly add hooks` to create the hook files in your source directory.
1414
!!!
1515

16-
| Hook File | Description
17-
|---------------------|---------------
18-
| `src/initialize.sh` | Execute code inside the `initialize()` function, which is called before anything else.
19-
| `src/before.sh` | Execute code before calling any command, but after processing the command line input. The `args` dictionary is available to you here, as well as the `input` array, which contains the normalized command line arguments.
20-
| `src/after.sh` | Execute code after calling any command.
16+
## Hook Files
2117

22-
[!button variant="primary" icon="code-review" text="Hooks Example"](https://github.com/bashly-framework/bashly/tree/master/examples/hooks#readme)
18+
19+
### `src/initialize.sh`
20+
21+
Execute code inside the `initialize()` function, which is called before anything
22+
else. The `command_line` array is available to you here, allowing you to read
23+
or modify (not recommended) the input command line.
24+
25+
### `src/before.sh`
26+
27+
Execute code before calling any command, but after processing the command line
28+
input. The `args` and `extra_args` arrays are available to you here, as well as
29+
the `input` array, which contains the normalized command line arguments.
30+
31+
### `src/after.sh`
32+
33+
Execute code after calling any command.
34+
35+
[!button variant="primary" icon="code-review" text="Hooks Example"](https://github.com/bashly-framework/bashly/tree/master/examples/hooks#readme) [!button variant="primary" icon="code-review" text="Command Line Manipulation Example"](https://github.com/bashly-framework/bashly/tree/master/examples/command-line-manipulation#readme)
2336

2437
## Alternatives
2538

0 commit comments

Comments
 (0)