summaryrefslogtreecommitdiffstats
path: root/bash-completion/wdctl
diff options
context:
space:
mode:
Diffstat (limited to 'bash-completion/wdctl')
-rw-r--r--bash-completion/wdctl14
1 files changed, 10 insertions, 4 deletions
diff --git a/bash-completion/wdctl b/bash-completion/wdctl
index 4f16e7607..811b5e3cc 100644
--- a/bash-completion/wdctl
+++ b/bash-completion/wdctl
@@ -23,11 +23,17 @@ _wdctl_module()
return 0
;;
'-o'|'--output')
- # FIXME: how to append to a string with compgen?
- local OUTPUT
- OUTPUT="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE"
+ local prefix realcur OUTPUT_ALL OUTPUT
+ realcur="${cur##*,}"
+ prefix="${cur%$realcur}"
+ OUTPUT_ALL="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE"
+ for WORD in $OUTPUT_ALL; do
+ if ! [[ $prefix == *"$WORD"* ]]; then
+ OUTPUT="$WORD $OUTPUT"
+ fi
+ done
compopt -o nospace
- COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
return 0
;;
'-s'|'--settimeout')