diff options
Diffstat (limited to 'bash-completion/prlimit')
-rw-r--r-- | bash-completion/prlimit | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bash-completion/prlimit b/bash-completion/prlimit index c6802143d..fff7a85c5 100644 --- a/bash-completion/prlimit +++ b/bash-completion/prlimit @@ -11,11 +11,17 @@ _prlimit_module() return 0 ;; '-o'|'--output') - # FIXME: how to append to a string with compgen? - local OUTPUT - OUTPUT="DESCRIPTION RESOURCE SOFT HARD UNITS" + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="DESCRIPTION RESOURCE SOFT HARD UNITS" + 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 ;; '-h'|'--help'|'-V'|'--version') |