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 <kerolasa@xxxxxx> --- bash-completion/chrt | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/bash-completion/chrt b/bash-completion/chrt index 388d298..ce0b915 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 -- 2.8.0 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html