mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Add asdf shim-versions command
(#380)
For example `asdf shim-versions npm` will list the plugins and their versions on which the `npm` command is available. Based on #432
This commit is contained in:
parent
4766a2b0b2
commit
7fda291df0
@ -16,6 +16,8 @@ Features
|
|||||||
slower `get_preset_version_for` which takes legacy formats into account.
|
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.
|
* Shim exec recommends which plugins or versions to set when command is not found.
|
||||||
* `asdf reshim` without arguments now reshims all installed plugins (#407)
|
* `asdf reshim` without arguments now reshims all installed plugins (#407)
|
||||||
|
* Add `asdf shim-versions <executable>` to list on which plugins and versions is a command
|
||||||
|
available. (#380)
|
||||||
|
|
||||||
Fixed Bugs
|
Fixed Bugs
|
||||||
|
|
||||||
|
7
bin/asdf
7
bin/asdf
@ -17,6 +17,8 @@ source "$(dirname "$(dirname "$0")")/lib/commands/current.sh"
|
|||||||
source "$(dirname "$(dirname "$0")")/lib/commands/where.sh"
|
source "$(dirname "$(dirname "$0")")/lib/commands/where.sh"
|
||||||
# shellcheck source=lib/commands/which.sh
|
# shellcheck source=lib/commands/which.sh
|
||||||
source "$(dirname "$(dirname "$0")")/lib/commands/which.sh"
|
source "$(dirname "$(dirname "$0")")/lib/commands/which.sh"
|
||||||
|
# shellcheck source=lib/commands/shim_versions.sh
|
||||||
|
source "$(dirname "$(dirname "$0")")/lib/commands/shim_versions.sh"
|
||||||
# shellcheck source=lib/commands/version_commands.sh
|
# shellcheck source=lib/commands/version_commands.sh
|
||||||
source "$(dirname "$(dirname "$0")")/lib/commands/version_commands.sh"
|
source "$(dirname "$(dirname "$0")")/lib/commands/version_commands.sh"
|
||||||
# shellcheck source=lib/commands/list.sh
|
# shellcheck source=lib/commands/list.sh
|
||||||
@ -83,9 +85,6 @@ case $1 in
|
|||||||
"list-all")
|
"list-all")
|
||||||
list_all_command $callback_args;;
|
list_all_command $callback_args;;
|
||||||
|
|
||||||
"shim")
|
|
||||||
shim_command $callback_args;;
|
|
||||||
|
|
||||||
"reshim")
|
"reshim")
|
||||||
reshim_command $callback_args;;
|
reshim_command $callback_args;;
|
||||||
|
|
||||||
@ -111,6 +110,8 @@ case $1 in
|
|||||||
"plugin-test")
|
"plugin-test")
|
||||||
plugin_test_command $callback_args;;
|
plugin_test_command $callback_args;;
|
||||||
|
|
||||||
|
"shim-versions")
|
||||||
|
shim_versions_command $callback_args;;
|
||||||
*)
|
*)
|
||||||
help_command
|
help_command
|
||||||
exit 1;;
|
exit 1;;
|
||||||
|
3
help.txt
3
help.txt
@ -17,7 +17,7 @@ MANAGE PACKAGES
|
|||||||
asdf current Display current version set or being used for all packages
|
asdf current Display current version set or being used for all packages
|
||||||
asdf current <name> Display current version set or being used for package
|
asdf current <name> Display current version set or being used for package
|
||||||
asdf where <name> [<version>] Display install path for an installed or current version
|
asdf where <name> [<version>] Display install path for an installed or current version
|
||||||
asdf which <name> Display install path for current version
|
asdf which <executable> Display the path to an executable
|
||||||
asdf local <name> <version> Set the package local version
|
asdf local <name> <version> Set the package local version
|
||||||
asdf global <name> <version> Set the package global version
|
asdf global <name> <version> Set the package global version
|
||||||
asdf list <name> List installed versions of a package
|
asdf list <name> List installed versions of a package
|
||||||
@ -26,6 +26,7 @@ MANAGE PACKAGES
|
|||||||
|
|
||||||
UTILS
|
UTILS
|
||||||
asdf reshim <name> <version> Recreate shims for version of a package
|
asdf reshim <name> <version> Recreate shims for version of a package
|
||||||
|
asdf shim-versions <executable> List on which plugins and versions is an executable provided.
|
||||||
asdf update Update asdf to the latest stable release
|
asdf update Update asdf to the latest stable release
|
||||||
asdf update --head Update asdf to the latest on the master branch
|
asdf update --head Update asdf to the latest on the master branch
|
||||||
|
|
||||||
|
4
lib/commands/shim_versions.sh
Normal file
4
lib/commands/shim_versions.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
shim_versions_command() {
|
||||||
|
local shim_name=$1
|
||||||
|
shim_plugin_versions "$shim_name"
|
||||||
|
}
|
33
test/shim_versions_command.bats
Normal file
33
test/shim_versions_command.bats
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load test_helpers
|
||||||
|
|
||||||
|
. $(dirname $BATS_TEST_DIRNAME)/lib/commands/shim_versions.sh
|
||||||
|
. $(dirname $BATS_TEST_DIRNAME)/lib/commands/reshim.sh
|
||||||
|
. $(dirname $BATS_TEST_DIRNAME)/lib/commands/install.sh
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
setup_asdf_dir
|
||||||
|
install_dummy_plugin
|
||||||
|
|
||||||
|
PROJECT_DIR=$HOME/project
|
||||||
|
mkdir -p $PROJECT_DIR
|
||||||
|
cd $PROJECT_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
teardown() {
|
||||||
|
clean_asdf_dir
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "shim_versions_command should list plugins and versions where command is available" {
|
||||||
|
cd $PROJECT_DIR
|
||||||
|
run install_command dummy 3.0
|
||||||
|
run install_command dummy 1.0
|
||||||
|
run reshim_command dummy
|
||||||
|
|
||||||
|
run shim_versions_command dummy
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
|
echo "$output" | grep "dummy 3.0"
|
||||||
|
echo "$output" | grep "dummy 1.0"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user