diff options
author | Sami Kerola <kerolasa@iki.fi> | 2016-04-03 09:35:28 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2016-04-04 10:26:03 +0200 |
commit | 0fc63d38f3257417bc555981ba50620a60620a66 (patch) | |
tree | d8570f0fe335059c0977d61f1e56411660ea30f4 | |
parent | b3a50671480095c3723ef0792d5f80aba80f31b2 (diff) | |
download | util-linux-0fc63d38f3257417bc555981ba50620a60620a66.tar.gz |
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 <kerolasa@iki.fi>
-rw-r--r-- | bash-completion/chrt | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/bash-completion/chrt b/bash-completion/chrt index 388d29819..ce0b915b3 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 |