Skip to content

Commit a644365

Browse files
authored
Fix no versions completion error (#63)
2 parents 5d4a121 + 181aa95 commit a644365

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

bash_completion

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ _dvm_completion() {
136136
fi
137137
;;
138138
"use"|"uninstall"|"which")
139-
if ! _dvm_has_non_option_parameter
139+
if ! _dvm_has_non_option_parameter "$cur"
140140
then
141141
if [ "$command" = "which" ] && _dvm_has_active_version
142142
then
@@ -148,7 +148,7 @@ _dvm_completion() {
148148
fi
149149
;;
150150
"run")
151-
if _dvm_has_non_option_parameter
151+
if _dvm_has_non_option_parameter "$cur"
152152
then
153153
COMPREPLY=( "$(compgen -W "${opts}" -- "${cur}")" )
154154
return
@@ -158,7 +158,7 @@ _dvm_completion() {
158158
_dvm_add_aliases_to_opts
159159
;;
160160
"unalias")
161-
if [ "$COMP_CWORD" == 2 ] || ! _dvm_has_non_option_parameter
161+
if [ "$COMP_CWORD" == "2" ] || ! _dvm_has_non_option_parameter "$cur"
162162
then
163163
_dvm_add_aliases_to_opts
164164
fi
@@ -181,8 +181,16 @@ _dvm_has_active_version() {
181181

182182
# Checks whether the parameters list have non-option parameter or not.
183183
_dvm_has_non_option_parameter() {
184+
local cur
185+
cur="$1"
186+
184187
for word in "${COMP_WORDS[@]:2}"
185188
do
189+
if [ "$word" == "" ] || [ "$word" == "$cur" ]
190+
then
191+
continue
192+
fi
193+
186194
if [[ "$word" != -* ]]
187195
then
188196
true

0 commit comments

Comments
 (0)