diff options
author | Clint Adams <clint@users.sourceforge.net> | 2008-09-21 14:22:31 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2008-09-21 14:22:31 +0000 |
commit | 05ddfc0cbca6782937b317f7530e5eb850ffd920 (patch) | |
tree | 3582facc1d479610b0066e04809b27298f14f496 /Completion/Linux | |
parent | 5cae0e52071908c71938e418da010d2131c828d1 (diff) | |
download | zsh-05ddfc0cbca6782937b317f7530e5eb850ffd920.tar.gz zsh-05ddfc0cbca6782937b317f7530e5eb850ffd920.tar.xz zsh-05ddfc0cbca6782937b317f7530e5eb850ffd920.zip |
Jörg Sommer: 25702: completions for chrt and ionice commands.
Diffstat (limited to 'Completion/Linux')
-rw-r--r-- | Completion/Linux/Command/_chrt | 61 | ||||
-rw-r--r-- | Completion/Linux/Command/_ionice | 23 |
2 files changed, 84 insertions, 0 deletions
diff --git a/Completion/Linux/Command/_chrt b/Completion/Linux/Command/_chrt new file mode 100644 index 000000000..f82ec8b81 --- /dev/null +++ b/Completion/Linux/Command/_chrt @@ -0,0 +1,61 @@ +#compdef chrt + +local context state line +typeset -A opt_args + +_arguments \ + '(* -)'{-h,--help}'[display usage information]' \ + '(* -)'{-V,--version}'[output version information]' \ + {-v,--verbose}'[display status information]' \ + {-p,--pid}'[interpret args as process ID]' \ + '(-b --batch -f --fifo -o --other -r --rr)'{-b,--batch}'[set scheduling policy to SCHED_BATCH]' \ + '(-b --batch -f --fifo -o --other -r --rr)'{-f,--fifo}'[set scheduling policy to SCHED_FIFO]' \ + '(-b --batch -f --fifo -o --other -r --rr)'{-o,--other}'[set policy scheduling policy to SCHED_OTHER]' \ + '(-b --batch -f --fifo -o --other -r --rr)'{-r,--rr}'[set scheduling policy to SCHED_RR]' \ + '(* -)'{-m,--max}'[show minimum and maximum valid priorities, then exit]' \ + '*::command or priority:->cmd_or_prio' \ + && return 0 + +_chrt_priority() +{ + local ty + if (( $+opt_args[-b] || $+opt_args[--batch] )) + then + ty=BATCH + elif (( $+opt_args[-f] || $+opt_args[--fifo] )) + then + ty=FIFO + elif (( $+opt_args[-o] || $+opt_args[--other] )) + then + ty=OTHER + else + ty=RR + fi + local range + range=${${"$(_call_program priorities chrt --max)"#*SCHED_$ty*: }%$'\n'*} + if [[ $range = 0/0 ]] + then + compadd 0 + else + _message -e priority "priority in the range $range" + fi +} + +if (( $+opt_args[-p] || $+opt_args[--pid] )) +then + if [[ $CURRENT -eq 1 ]] + then + _alternative \ + 'priority:priority:_chrt_priority' \ + 'processes:process IDs:_pids' + else + _pids + fi +elif [[ $CURRENT -eq 1 ]] +then + _chrt_priority +else + shift words + (( CURRENT-- )) + _normal +fi diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice new file mode 100644 index 000000000..7a4060341 --- /dev/null +++ b/Completion/Linux/Command/_ionice @@ -0,0 +1,23 @@ +#compdef ionice + +local context state line +typeset -A opt_args + +_arguments \ + '(* -)-h[display usage information]' \ + '-p[interpret args as process ID]' \ + '-c[scheduling class]:class:(( 1\:realtime 2\:best-effort 3\:idle ))' \ + '-n[scheduling class priority]:class-pririty:(( + 0\:high\ priority + {1..6}\: + 7\:low\ priority + ))' \ + '*::command or pid:->cmd_or_pid' \ + && return 0 + +if (( $+opt_args[-p] )) +then + _pids +else + _normal +fi |