From: Sami Kerola Date: Sun, 3 Apr 2016 08:35:28 +0000 (+0100) Subject: bash-completion: update chrt completion X-Git-Tag: v2.28~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0fc63d38f3257417bc555981ba50620a60620a66;p=thirdparty%2Futil-linux.git bash-completion: update chrt completion Add couple missing options, and make the completion overall work better. That said completion is still incomplete, pardon the pun. After user has specified policy then giving a hint what priority needs to be specified is theoretically possible, but such hint is not given. There does not seem to be easy way to know when user wants stops specifying options and move to defining priority in: chrt [options] [prio] [command|pid]. Signed-off-by: Sami Kerola --- diff --git a/bash-completion/chrt b/bash-completion/chrt index 388d298195..ce0b915b33 100644 --- a/bash-completion/chrt +++ b/bash-completion/chrt @@ -8,31 +8,45 @@ _chrt_module() '-h'|'--help'|'-V'|'--version') return 0 ;; + '-T'|'--sched-runtime'|'-P'|'--sched-period'|'-D'|'--sched-deadline') + COMPREPLY=( $(compgen -W "nanoseconds" -- $cur) ) + return 0 + ;; esac - # FIXME: -p is ambiguous, it takes either pid or priority as an - # argument depending on whether user wanted to get or set the - # values. Perhaps the command interface should be reconsidered. case $cur in -*) - OPTS="--batch - --fifo - --idle - --other - --rr - --reset-on-fork + OPTS=" --all-tasks + --batch + --deadline + --fifo --help + --idle --max + --other --pid + --reset-on-fork + --rr + --sched-deadline + --sched-period + --sched-runtime --verbose - --version" + --version + " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac - local PIDS - PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) - COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) + local i + for i in ${COMP_WORDS[*]}; do + case $i in + '-p'|'--pid') + COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) ) + return 0 + ;; + esac + done + COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _chrt_module chrt