mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Implement plugin hook to customize executable path
This feature allows the plugin to optionally change the executable path of a shim prior to execution. This is useful when the plugin tool has commands that may exist in multiple locations (like npm).
This commit is contained in:
parent
27b5e21db3
commit
d94e0223bf
@ -27,6 +27,12 @@ for version in "${versions[@]}"; do
|
||||
exit 127
|
||||
fi
|
||||
|
||||
# custom plugin hook for executable path
|
||||
if [ -f "${plugin_path}/bin/exec-path" ]; then
|
||||
cmd=$(basename "$executable_path")
|
||||
executable_path="$("${plugin_path}/bin/exec-path" "$install_path" "$cmd" "$executable_path")"
|
||||
fi
|
||||
|
||||
if full_executable_path=$(get_executable_path "$plugin_name" "$version" "$executable_path"); then
|
||||
if [ -f "$full_executable_path" ]; then
|
||||
if [ -f "${plugin_path}/bin/exec-env" ]; then
|
||||
|
@ -57,6 +57,21 @@ If this script is not specified, asdf will look for the `bin` dir in an installa
|
||||
|
||||
Setup the env to run the binaries in the package.
|
||||
|
||||
#### bin/exec-path
|
||||
|
||||
Get the executable path for the specified version of the tool. Must print a string with the relative executable path. This allows the plugin to conditionally override the shim's specified executable path, otherwise return the default path specified by the shim.
|
||||
|
||||
```
|
||||
Usage:
|
||||
plugin/bin/exec-path <install-path> <command> <executable-path>
|
||||
|
||||
Example Call:
|
||||
~/.asdf/plugins/foo/bin/exec-path "~/.asdf/installs/foo/1.0" "foo" "bin/foo"
|
||||
|
||||
Output:
|
||||
bin/foox
|
||||
```
|
||||
|
||||
#### bin/uninstall
|
||||
|
||||
Uninstalls a specific version of a tool.
|
||||
|
Loading…
Reference in New Issue
Block a user