-
Notifications
You must be signed in to change notification settings - Fork 783
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
user configurable pre-post command hooks #434
Conversation
Features * New shim version meta-data allows shims to not depend on a particular plugin nor on its relative executable path (asdf-vm#431) Upgrading requires shim re-generation and should happen automatically by `asdf-exec`: `rm -rf ~/.asdf/shims/` followed by `asdf reshim` * Added lots of tests for shim execution. We now make sure that shim execution obeys plugins hooks like `list-bin-paths` and `exec-path`. * Shim exec is now performed by a new `bin/private/asdf-tool-exec` that might be faster for most common use case: (versions on local .tool-versions file) but fallbacks to slower `get_preset_version_for` which takes legacy formats into account. * Shim exec recommends which plugins or versions to set when command is not found. Fixed Bugs * Allow many plugins to provide shims with same executable name (asdf-vm#431)
Features * New shim version meta-data allows shims to not depend on a particular plugin nor on its relative executable path (asdf-vm#431) Upgrading requires shim re-generation and should happen automatically by `asdf-exec`: `rm -rf ~/.asdf/shims/` followed by `asdf reshim` * Added lots of tests for shim execution. We now make sure that shim execution obeys plugins hooks like `list-bin-paths` and `exec-path`. * Shim exec is now performed by a new `bin/private/asdf-tool-exec` that might be faster for most common use case: (versions on local .tool-versions file) but fallbacks to slower `get_preset_version_for` which takes legacy formats into account. * Shim exec recommends which plugins or versions to set when command is not found. Fixed Bugs * Allow many plugins to provide shims with same executable name (asdf-vm#431)
Suppose a `foo` plugin is installed and provides a `bar` executable. The following hooks will be executed when set in `.asdfrc`: ```shell post_asdf_install_foo = echo installed foo version ${1} post_asdf_reshim_foo = echo reshimmed foo version ${1} pre_foo_bar = echo about to execute command bar from foo with args: ${@} post_foo_bar = echo just executed command bar from foo with args: ${@} ```
if [ -n "$hook_cmd" ]; then | ||
asdf_hook_fun() { | ||
unset asdf_hook_fun | ||
ev'al' "$hook_cmd" # ignore banned command just here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't just $hook_cmd
be equivalent to this code?
@vic I've been trying to get a post hook installed (auto-reshim after running
And I added this to ~/.asdfrc
but |
@colinta since |
@colinta Looks like a bug in documentation now, since those post-command-hooks have already been removed |
Suppose a
foo
plugin is installed and provides abar
executable.The following hooks will be executed when set in
.asdfrc
:Based on changes from #432