fix(completions): Address two Bash completion bugs (#1770)

Co-authored-by: Trevor Brown <Stratus3D@users.noreply.github.com>
This commit is contained in:
Ben Blank 2024-12-17 04:42:20 -08:00 committed by GitHub
parent bd19e4cbdc
commit ebdb229ce6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,7 @@ _asdf() {
COMPREPLY=($(compgen -W "$available_plugins" -- "$cur"))
;;
install | list | list-all | help)
if [[ "$plugins" == *"$prev"* ]]; then
if [[ " $plugins " == *" $prev "* ]]; then
local versions
versions=$(asdf list-all "$prev" 2>/dev/null)
# shellcheck disable=SC2207
@ -54,9 +54,10 @@ _asdf() {
COMPREPLY=($(compgen -W "--head" -- "$cur"))
;;
uninstall | where | reshim)
if [[ "$plugins" == *"$prev"* ]]; then
if [[ " $plugins " == *" $prev "* ]]; then
local versions
versions=$(asdf list "$prev" 2>/dev/null)
# The first two columns are either blank or contain the "current" marker.
versions=$(asdf list "$prev" 2>/dev/null | colrm 1 2)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
else
@ -65,9 +66,10 @@ _asdf() {
fi
;;
local | global | shell)
if [[ "$plugins" == *"$prev"* ]]; then
if [[ " $plugins " == *" $prev "* ]]; then
local versions
versions=$(asdf list "$prev" 2>/dev/null)
# The first two columns are either blank or contain the "current" marker.
versions=$(asdf list "$prev" 2>/dev/null | colrm 1 2)
versions+=" system"
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$versions" -- "$cur"))