Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Improve .asdfrc plugin hook docuentation #1661

Merged
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
25 changes: 25 additions & 0 deletions docs/manage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,31 @@ The default number of cores to use during compilation.

Note: the environment variable `ASDF_CONCURRENCY` take precedence if set.

### Plugin Hooks

It is possible to execute custom code:

- Before or after a plugin is installed, reshimed, updated, or uninstalled
- Before or after a plugin command is executed

For example, if a plugin called `foo` is installed and provides a `bar` executable, then the following hooks can be used to execute custom code first:

```text
pre_foo_bar = echo Executing with args: $@
```

The following patterns are supported:

- `pre_<plugin_name>_<command>`
- `pre_asdf_download_<plugin_name>`
- `{pre,post}_asdf_{install,reshim,uninstall}_<plugin_name>`
- `$1`: full version
- `{pre,post}_asdf_plugin_{add,update,remove,reshim}`
- `$1`: plugin name
- `{pre,post}_asdf_plugin_{add,update,remove}_<plugin_name>`

See [Create a Plugin](../plugins/create.md) for specifics on what command hooks are ran before or after what commands.

## Environment Variables

Setting environment variables varies depending on your system and Shell. Default locations depend upon your installation location and method (Git clone, Homebrew, AUR).
Expand Down
10 changes: 5 additions & 5 deletions docs/plugins/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -685,14 +685,14 @@ No parameters provided.

**Description**

Execute this callback script **after** asdf has downloaded the _updated_ plugin with `asdf plugin update <tool> [<git-ref>]`.
Execute this callback script **after** asdf has downloaded the _update_ plugin with `asdf plugin update <tool> [<git-ref>]`.

See also the related command hooks:

- `pre_asdf_plugin_updated`
- `pre_asdf_plugin_updated_${plugin_name}`
- `post_asdf_plugin_updated`
- `post_asdf_plugin_updated_${plugin_name}`
- `pre_asdf_plugin_update`
- `pre_asdf_plugin_update_${plugin_name}`
- `post_asdf_plugin_update`
- `post_asdf_plugin_update_${plugin_name}`

**Environment Variables available to script**

Expand Down
8 changes: 4 additions & 4 deletions docs/zh-hans/plugins/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ bin tools veggies

其他请参考相关钩子:

- `pre_asdf_plugin_updated`
- `pre_asdf_plugin_updated_${plugin_name}`
- `post_asdf_plugin_updated`
- `post_asdf_plugin_updated_${plugin_name}`
- `pre_asdf_plugin_update`
- `pre_asdf_plugin_update_${plugin_name}`
- `post_asdf_plugin_update`
- `post_asdf_plugin_update_${plugin_name}`

#### bin/pre-plugin-remove

Expand Down
Loading