Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Completion for chrt and ionice
- X-seq: zsh-workers 25702
- From: Jörg Sommer <joerg@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: [PATCH] Completion for chrt and ionice
- Date: Sun, 21 Sep 2008 13:59:14 +0000 (UTC)
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=gnuu.de; s=banki; t=1222005779; i=@xxxxxxxxxxxx; bh=wKGqwAdNqpD9veR9mUpfVJc0W/SjdFN3A lPvoK4fku8=; h=To:From:Subject:Date:Message-ID:Mime-Version: Content-Type:Content-Transfer-Encoding:Sender; b=EH9Y4t2kRN2ucf1AE iF51Ki5QDI7FB6GNtjkwgxyzT9ng6aYT/mWanofsz5fPjrJmZHi1mWB1iXuv/oBmnzl EzNjUifTxy3+/O8SnkHdO5uysMw4VH731GhwwOsl40mjVU7uK+5luBCmDgcVAcmgBcc nIt82R6EMZGp1f4n0LaU=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: news <news@xxxxxxxxxxxx>
Hi,
commit 14b01890163625d1aa41610beb46e00155090308
Author: Jörg Sommer <joerg@xxxxxxxxxxxx>
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@xxxxxxxxxxxx>
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)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author