From: "Jörg Sommer" <joerg@alea.gnuu.de>
To: zsh-workers@sunsite.dk
Subject: [PATCH] Completion for chrt and ionice
Date: Sun, 21 Sep 2008 13:59:14 +0000 (UTC) [thread overview]
Message-ID: <slrngdckpi.23d.joerg@alea.gnuu.de> (raw)
Hi,
commit 14b01890163625d1aa41610beb46e00155090308
Author: Jörg Sommer <joerg@alea.gnuu.de>
Date: Sun Sep 21 15:51:36 2008 +0200
Completion for the Linux command ionice
The command ionice is used on Linux to get or set the IO scheduling
attributes of a process.
diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice
new file mode 100644
index 0000000..e3b64aa
--- /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
commit fc7231b2bd501b2a3dc753567c2ae8c4deddf9e7
Author: Jörg Sommer <joerg@alea.gnuu.de>
Date: Sun Sep 21 15:50:10 2008 +0200
Completion for the Linux command chrt
The command chrt is used on Linux to get or set the real‐time attributes
of a process.
diff --git a/Completion/Linux/Command/_chrt b/Completion/Linux/Command/_chrt
new file mode 100644
index 0000000..f82ec8b
--- /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
Bye, Jörg.
--
Macht besitzen und nicht ausüben ist wahre Größe.
(Friedl Beutelrock)
next reply other threads:[~2008-09-21 14:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-21 13:59 Jörg Sommer [this message]
2008-09-22 16:53 ` Jörg Sommer
2008-09-23 5:28 ` Clint Adams
2008-10-03 1:11 ` Jörg Sommer
2008-10-03 2:32 ` Clint Adams
2008-10-03 16:07 ` Jörg Sommer
2008-10-04 18:15 ` Clint Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrngdckpi.23d.joerg@alea.gnuu.de \
--to=joerg@alea.gnuu.de \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).