Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: completion for a couple more builtins
- X-seq: zsh-workers 13947
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: completion for a couple more builtins
- Date: Wed, 11 Apr 2001 21:10:36 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: opk
This patch adds _arguments based completion for alias and jobs.
Unfortunately, _jobs already exists for completing jobs so I've had to
use the name _jobs_builtin. I'm happy to rename this if anyone can think
of a better name. These were the only builtins I identified as using an
existing completion but needing a proper one using _arguments.
To summarise, remaining builtins lacking a proper completion are:
pushln, getln, limit, unlimit, unset - possibly should be done
exit, bye, logout, return - should we use the _message completion
suggested?
echoti - if we sort out ${(k)terminfo} this would be easy
[, test - should we use the _message suggestion directing users to
[[..]]?
echo, pwd - easy if we ignore the possibility that it is echo/pwd from
/bin
dirs, suspend, zprof, unalias - only take one option which makes it a
bit pointless
break, continue, comp*, zformat, zparseopts, zregexparse - not useful
interactively
umask - would just be _message so a bit pointless
_typeset should possibly handle autoload and functions
there is also the cap and clone modules but I never use them so am not
sure what they should be.
Oliver
Index: Completion/Zsh/Command/_alias
===================================================================
RCS file: _alias
diff -N _alias
--- /dev/null Mon Dec 11 17:26:27 2000
+++ _alias Wed Apr 11 14:06:46 2001
@@ -0,0 +1,8 @@
+#compdef alias
+
+_arguments -C -s -A "-*" -S \
+ '-+g[list or define global aliases]' \
+ '-+r[list or define regular aliases]' \
+ '-+m[print aliases matching specified pattern]' \
+ '-L[print each alias in the form of calls to alias]' \
+ '*::alias definition:_aliases -S ='
Index: Completion/Zsh/Command/_fc
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_fc,v
retrieving revision 1.1
diff -u -r1.1 _fc
--- Completion/Zsh/Command/_fc 2001/04/02 11:28:31 1.1
+++ Completion/Zsh/Command/_fc 2001/04/11 21:06:46
@@ -1,13 +1,13 @@
#compdef fc history r
-local expl fc_common fc_hist fc_r
+local fc_common fc_hist fc_r
fc_common=(
'(-A -R -W -I)-r[reverse order of the commands]'
'(-A -R -W -I -e)-n[suppress line numbers]'
'(-A -R -W -I)*::commands:_command_names -e' )
-fc_hist=( \
+fc_hist=(
'(-A -R -W -I)-m[treat first argument as a pattern]'
'(-A -R -W -I -e -f -E -i)-d[print time-stamps]'
'(-A -R -W -I -e -d -E -i)-f[mm/dd/yyyy format time-stamps]'
@@ -19,13 +19,13 @@
case $service in
history)
- _arguments -C -s -S "$fc_common[@]" "$fc_hist[@]" && return 0
+ _arguments -s -S "$fc_common[@]" "$fc_hist[@]" && return 0
;;
r)
- _arguments -C -s -S "$fc_common[@]" "$fc_r" && return 0
+ _arguments -s -S "$fc_common[@]" "$fc_r" && return 0
;;
*)
- _arguments -C -s -S \
+ _arguments -s -S \
'(-A -R -W -I -l -n -d -f -E -i -D)-e[specify editor to
invoke]:editor to invoke:_command_names -e' \
'(-l -m -e -r -n -d -f -E -i -D -A -W *)-R[read history from
file]:history file:_files' \
'(-l -m -e -r -n -d -f -E -i -D -R -W *)-A[append history to
file]:history file:_files' \
Index: Completion/Zsh/Command/_jobs_builtin
===================================================================
RCS file: _jobs_builtin
diff -N _jobs_builtin
--- /dev/null Mon Dec 11 17:26:27 2000
+++ _jobs_builtin Wed Apr 11 14:06:46 2001
@@ -0,0 +1,10 @@
+#compdef jobs
+
+_arguments -C -s \
+ "(-d -l -p -r -s *)-Z[specify string to replace shell's argument and
environment with]:string" \
+ '(-Z)-d[show directory from which to job was started]' \
+ '(-Z)-l[list process IDs]' \
+ '(-Z)-p[list process groups]' \
+ '(-Z -s)-r[list only running jobs]' \
+ '(-Z -r)-s[list only stopped jobs]' \
+ '(-Z)*::job:_jobs'
Index: Completion/Zsh/Type/_aliases
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_aliases,v
retrieving revision 1.1
diff -u -r1.1 _aliases
--- Completion/Zsh/Type/_aliases 2001/04/02 11:18:06 1.1
+++ Completion/Zsh/Type/_aliases 2001/04/11 21:06:47
@@ -1,4 +1,4 @@
-#compdef alias unalias
+#compdef unalias
local expl sel args opts
Index: Completion/Zsh/Type/_jobs_fg
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_jobs_fg,v
retrieving revision 1.1
diff -u -r1.1 _jobs_fg
--- Completion/Zsh/Type/_jobs_fg 2001/04/02 11:21:11 1.1
+++ Completion/Zsh/Type/_jobs_fg 2001/04/11 21:06:47
@@ -1,3 +1,3 @@
-#compdef disown fg jobs
+#compdef disown fg
_jobs
Messages sorted by:
Reverse Date,
Date,
Thread,
Author