Skip to content

Commit ea46f81

Browse files
author
Andrii Sultanov
committed
xe-cli completion: Hide COMPREPLY manipulation behind functions
Though the majority of completions were already using set_completions and the like to add completion suggestions, there were two leftovers still needlessly changing COMPREPLY themselves. This caused bugs, as in the case of xe vm-import filename=<TAB> autocompleting all of the filenames into the prompt instead of presenting the choice. Let only these functions operate on COMPREPLY directly. Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
1 parent eeec845 commit ea46f81

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ocaml/xe-cli/bash-completion

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ _xe()
143143
IFS=$'\n,'
144144
# Here we actually WANT file name completion, so using compgen is OK.
145145
local comp_files=$(compgen -f "$value")
146-
COMPREPLY=( "$comp_files" )
147146
__xe_debug "triggering filename completion for the value:"
148147
__xe_debug $(__tab_delimited_newline_array "$comp_files")
148+
set_completions "$comp_files" "$value"
149149
return 0
150150
;;
151151

@@ -156,7 +156,6 @@ _xe()
156156
if [ "${OLDSTYLE_WORDS[1]}" == "pif-reconfigure-ip" ]; then
157157
IFS=$'\n,'
158158
suggested_modes="dhcp,static,none"
159-
COMPREPLY=( $(compgen -W "dhcp ,static ,none" -- "$value") )
160159
elif [ "${COMP_WORDS[1]}" == "pif-reconfigure-ipv6" ]; then
161160
IFS=$'\n,'
162161
suggested_modes="dhcp,static,none,autoconf"

0 commit comments

Comments
 (0)