Let asdf help show plugin commands when available.

Also fix `asdf list all` to work as subcommand. Fixes #602
This commit is contained in:
Victor Hugo Borja 2019-11-29 07:42:55 -06:00
parent 100917c0e4
commit 3f0fe57db9
3 changed files with 30 additions and 7 deletions

View File

@ -26,7 +26,7 @@ find_asdf_cmd() {
local asdf_cmd_dir
asdf_cmd_dir="$(asdf_dir)/lib/commands"
case "$1" in
('exec' | 'current' | 'env' | 'global' | 'install' | 'latest' | 'list' | 'local' |\
('exec' | 'current' | 'env' | 'global' | 'install' | 'latest' | 'local' |\
'reshim' | 'uninstall' | 'update' | 'where' | 'which' |\
'export-shell-version')
echo "$asdf_cmd_dir/command-$1" 2

View File

@ -22,7 +22,7 @@ MANAGE PACKAGES
asdf local <name> <version> Set the package local version
asdf global <name> <version> Set the package global version
asdf list <name> List installed versions of a package
asdf list-all <name> List all versions of a package
asdf list all <name> List all versions of a package
UTILS
@ -32,7 +32,3 @@ UTILS
asdf shim-versions <command> List on which plugins and versions is command available
asdf update Update asdf to the latest stable release
asdf update --head Update asdf to the latest on the master branch
"Late but latest"
-- Rajinikanth

View File

@ -1,9 +1,36 @@
# -*- sh -*-
help_command () {
asdf_help() {
echo "version: $(asdf_version)"
echo ""
cat "$(asdf_dir)/help.txt"
}
asdf_moto() {
cat <<EOF
"Late but latest"
-- Rajinikanth
EOF
}
asdf_extension_cmds() {
local plugins_path ext_cmds
plugins_path="$(get_plugin_path)"
ext_cmds="$(ls -1 "$plugins_path"/*/bin/command* 2>/dev/null | sed "s#$plugins_path/# asdf #;"'s#/bin/command##g;s#-# #g')"
if test -n "$ext_cmds"; then
echo "$ext_cmds" | cut -d' ' -f 4 | uniq | while read -r plugin; do
echo
echo "PLUGIN $plugin"
echo "$ext_cmds" | grep " asdf $plugin"
done
fi
}
help_command() {
asdf_help
asdf_extension_cmds
asdf_moto
}
help_command "$@"