From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Suggestion for _killall
Date: Fri, 19 Nov 1999 09:55:13 +0100 (MET) [thread overview]
Message-ID: <199911190855.JAA02150@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Falk Hueffner's message of 18 Nov 1999 22:24:48 +0100
Falk Hueffner wrote:
> Hi,
>
> I suggest this patch for _killall to also complete command names:
I suggest that we use the patch below instead -- it uses descriptions
and tags. This also (finally) adds the function `_signals' to complete
signal names and makes it be used everywhere. This also uses/tests the
prefix-needed and prefix-hidden styles.
Bye
Sven
diff -u -r oldcompletion/Builtins/_kill Completion/Builtins/_kill
--- oldcompletion/Builtins/_kill Thu Nov 18 08:51:26 1999
+++ Completion/Builtins/_kill Fri Nov 19 09:48:58 1999
@@ -1,10 +1,6 @@
#compdef kill
-local list expl
-
-if compset -P 1 -; then
- _wanted -C - expl signal &&
- compadd "$expl[@]" $signals[1,-3]
-else
- _alternative -C argument 'jobs:: _jobs' 'processes:: _pids'
-fi
+_alternative \
+ 'signals:: _signals -p' \
+ 'jobs:: _jobs' \
+ 'processes:: _pids'
diff -u -r oldcompletion/Builtins/_signals Completion/Builtins/_signals
--- oldcompletion/Builtins/_signals Fri Nov 19 09:50:30 1999
+++ Completion/Builtins/_signals Fri Nov 19 09:53:49 1999
@@ -0,0 +1,36 @@
+#autoload
+
+# Options (only in separate words):
+#
+# -a use all signals (even the pseudo-signals)
+# -p needs a `-' prefix
+#
+# A `-' or `--' as the first argument is ignored.
+
+local expl last=-3 minus
+
+while [[ "$1" = -[ap] ]]; do
+ if [[ "$1" = -a ]]; then
+ last=-1
+ else
+ minus=-
+ fi
+ shift
+done
+
+[[ "$1" = -(|-) ]] && shift
+
+if _wanted signals expl signal &&
+ { [[ -z "$minus" ]] || ! _style signals prefix-needed ||
+ [[ "$PREFIX" = -* ]] } ; then
+ local disp tmp
+
+ if _style signals prefix-hidden; then
+ tmp=( "${(@)signals[1,last]}" )
+ disp=(-d tmp)
+ else
+ disp=()
+ fi
+ compadd "$@" "$expl[@]" "$disp[@]" -M 'm:{a-z}=${A-Z}' - \
+ "${minus}${(@)^signals[1,last]}"
+fi
diff -u -r oldcompletion/Builtins/_trap Completion/Builtins/_trap
--- oldcompletion/Builtins/_trap Thu Nov 18 08:51:27 1999
+++ Completion/Builtins/_trap Fri Nov 19 09:50:16 1999
@@ -6,5 +6,5 @@
compset -q
_normal
else
- _wanted signals expl signal && compadd "$expl[@]" - "$signals[@]"
+ _signals -a
fi
diff -u -r oldcompletion/User/_killall Completion/User/_killall
--- oldcompletion/User/_killall Thu Nov 18 08:51:35 1999
+++ Completion/User/_killall Fri Nov 19 09:47:57 1999
@@ -1,4 +1,5 @@
#compdef killall
-compset -P 1 - && _wanted -C - signals expl signal &&
- compadd "$expl[@]" $signals[1,-3]
+_alternative \
+ 'signals:: _signals -p' \
+ 'processes:process:{ compadd "$expl[@]" ${$(ps ho comm 2> /dev/null):#(ps|COMMAND)} }'
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-11-19 9:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-19 8:55 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-11-19 9:21 Sven Wischnowsky
1999-11-18 21:24 Falk Hueffner
1999-11-19 10:10 ` Alexandre Duret-Lutz
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=199911190855.JAA02150@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.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).