Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Completion for chrt and ionice



Hi,

Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
> 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.

This completion is not correct. Here are patches for it:

commit 0488523c0581a74a321d8c1e1852bc0aa58a2003
Author: Jörg Sommer <joerg@xxxxxxxxxxxx>
Date:   Mon Sep 22 16:50:03 2008 +0200

    Reverse the order of unnamed priorities
    
    The completion was printed in reverse order. So add the entries in
    descending order to get the ascending ording in the help message.

diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice
index e3b64aa..fd49dcd 100644
--- a/Completion/Linux/Command/_ionice
+++ b/Completion/Linux/Command/_ionice
@@ -9,7 +9,7 @@ _arguments \
   '-c[scheduling class]:class:(( 1\:realtime 2\:best-effort 3\:idle ))' \
   '-n[scheduling class priority]:class-pririty:((
     0\:high\ priority
-    {1..6}\:
+    {6..1}\:
     7\:low\ priority
   ))' \
   '*::command or pid:->cmd_or_prio' \

commit e2da3b57bfa4145811aa3b3921edb329b7bef1f7
Author: Jörg Sommer <joerg@xxxxxxxxxxxx>
Date:   Mon Sep 22 16:54:28 2008 +0200

    The pid for -p must follow the option
    
    The process ID is the mandatory argument of the -p option.

diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice
index fd49dcd..b7cd21b 100644
--- a/Completion/Linux/Command/_ionice
+++ b/Completion/Linux/Command/_ionice
@@ -1,23 +1,12 @@
 #compdef ionice
 
-local context state line
-typeset -A opt_args
-
 _arguments \
   '(* -)-h[display usage information]' \
-  '-p[interpret args as process ID]' \
+  '(*)-p[interpret args as process ID]:pid:_pids' \
   '-c[scheduling class]:class:(( 1\:realtime 2\:best-effort 3\:idle ))' \
   '-n[scheduling class priority]:class-pririty:((
     0\:high\ priority
     {6..1}\:
     7\:low\ priority
   ))' \
-  '*::command or pid:->cmd_or_prio' \
-  && return 0
-
-if (( $+opt_args[-p] ))
-then
-    _pids
-else
-    _normal
-fi
+  '*::command:_normal'

Bye, Jörg.
-- 
“…anytime you install something new on the Windows platform, you risk
spending the next five or six hours trying to figure out what happened”
            (Robert Roblin, Adobe)



Messages sorted by: Reverse Date, Date, Thread, Author