From 311a40e6b866a97d6da126fcb1131dadb9301554 Mon Sep 17 00:00:00 2001 From: Ben Blank Date: Sun, 28 Jul 2024 11:04:38 -0700 Subject: [PATCH 1/2] fix(completions): Only match whole plugin names in Bash completions --- completions/asdf.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/completions/asdf.bash b/completions/asdf.bash index f828e9db5..595b264e1 100644 --- a/completions/asdf.bash +++ b/completions/asdf.bash @@ -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,7 +54,7 @@ _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) # shellcheck disable=SC2207 @@ -65,7 +65,7 @@ _asdf() { fi ;; local | global | shell) - if [[ "$plugins" == *"$prev"* ]]; then + if [[ " $plugins " == *" $prev "* ]]; then local versions versions=$(asdf list "$prev" 2>/dev/null) versions+=" system" From 613862538c834afc3464f31c4d90ff79e97ecf17 Mon Sep 17 00:00:00 2001 From: Ben Blank Date: Sun, 28 Jul 2024 11:05:44 -0700 Subject: [PATCH 2/2] fix(completions): Remove asterisk from versions in Bash completions --- completions/asdf.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/completions/asdf.bash b/completions/asdf.bash index 595b264e1..f3ad87ff8 100644 --- a/completions/asdf.bash +++ b/completions/asdf.bash @@ -56,7 +56,8 @@ _asdf() { uninstall | where | reshim) 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 @@ -67,7 +68,8 @@ _asdf() { local | global | shell) 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"))