summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/completion/bash/guix9
1 files changed, 8 insertions, 1 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 5d1ae37f125..6a11e1b23b3 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -72,10 +72,16 @@ _guix_complete_option ()
72{ 72{
73 local command="${COMP_WORDS[$1]}" 73 local command="${COMP_WORDS[$1]}"
74 local subcommand="${COMP_WORDS[$(($1 + 1))]}" 74 local subcommand="${COMP_WORDS[$(($1 + 1))]}"
75 if _guix_is_option "$subcommand" 75
76 if [ $1 -le 1 ]
77 then
78 command=""
79 subcommand=""
80 elif _guix_is_option "$subcommand"
76 then 81 then
77 subcommand="" 82 subcommand=""
78 fi 83 fi
84
79 local options="$(${COMP_WORDS[0]} $command $subcommand --help 2> /dev/null \ 85 local options="$(${COMP_WORDS[0]} $command $subcommand --help 2> /dev/null \
80 | grep '^ \+-' \ 86 | grep '^ \+-' \
81 | sed -e's/^.*--\([a-zA-Z0-9_-]\+\)\(=\?\).*/--\1\2/g')" 87 | sed -e's/^.*--\([a-zA-Z0-9_-]\+\)\(=\?\).*/--\1\2/g')"
@@ -229,6 +235,7 @@ _guix_complete ()
229 case $COMP_CWORD in 235 case $COMP_CWORD in
230 $command_index) 236 $command_index)
231 _guix_complete_command 237 _guix_complete_command
238 _guix_complete_option 0 "$word_at_point"
232 ;; 239 ;;
233 *) 240 *)
234 if [[ "$command" = "package" ]] 241 if [[ "$command" = "package" ]]