Skip to content

Commit

Permalink
fix(completions): Address two Bash completion bugs (#1770)
Browse files Browse the repository at this point in the history
Co-authored-by: Trevor Brown <[email protected]>
  • Loading branch information
benblank and Stratus3D authored Dec 17, 2024
1 parent bd19e4c commit ebdb229
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions completions/asdf.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"))
Expand Down

0 comments on commit ebdb229

Please sign in to comment.