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

PATCH: _apt, _socket and _perl_builtin_funcs



* _apt: support the form of option_prefix='...!command...'.
* _socket: more explanations.
* _perl_builtin_funcs: support systems that has no `-w' option with
  `man'. (Solaris 7)
  _perl_builtin_funcs does not work on Debian even now. Because the
  result of `man -w perlfunc' is gziped file --
  `/usr/man/man1/perlfunc.1p.gz'.

Index: Completion/Debian/_apt
===================================================================
RCS file: /projects/zsh/zsh/Completion/Debian/_apt,v
retrieving revision 1.1.1.4
diff -u -F^( -r1.1.1.4 _apt
--- _apt	1999/09/13 16:35:36	1.1.1.4
+++ _apt	1999/09/14 00:10:49
@@ -113,7 +113,7 @@
 tmp2=($_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
 compadd "$expl_opt[@]" -S= - $tmp2'
 
-  comp_opt='[[ -prefix - || -z "$compconfig[option_prefix]" ]]'" && { $comp_short; $comp_long }"
+  comp_opt='[[ -prefix - || -z "$compconfig[option_prefix]" || "$compconfig[option_prefix]" = *\!$words[1]* ]]'" && { $comp_short; $comp_long }"
 
   regex_short=()
   regex_long=()
Index: Completion/User/_socket
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_socket,v
retrieving revision 1.1.1.3
diff -u -F^( -r1.1.1.3 _socket
--- _socket	1999/09/13 18:22:21	1.1.1.3
+++ _socket	1999/09/14 00:10:49
@@ -8,22 +8,42 @@
 local state line expl
 typeset -A options
 
+if [[ $CURRENT -eq 2 && (
+  -z "$compconfig[option_prefix]" ||
+  "$compconfig[option_prefix]" = *\!${words[1]}* ||
+  "$PREFIX" = -* ) ]]; then
+  _description expl option
+  compadd -M 'r:|[_-]=* r:|=*' "$expl[@]" - -version
+fi
+
 _arguments -s \
-  -{b,c,f,q,r,v,w} \
-  -{s,l} \
-  '-p:command:->command' \
+  '-b[background]' \
+  '-c[crlf]' \
+  '-f[fork]' \
+  '-q[quit]' \
+  '-r[read only]' \
+  '-v[verbose]' \
+  '-w[write only]' \
+  '-s[server]' \
+  '-l[loop]' \
+  '-p[program]:command:->command' \
   ':arg1:->arg1' \
   ':arg2:->arg2'
 
 case "$state" in
 command)
   compset -q
-  _normal
+  if [[ $CURRENT -eq 1 ]]; then
+    _command_names -e "$@"
+  else
+    _normal
+  fi
   ;;
 
 arg1)
   if (( $+options[-s] )); then
-    _message 'port to listen'
+    _description expl 'port to listen'
+    _ports "$expl[@]"
   else
     _description expl 'host'
     _combination socket_hosts_ports hosts "$expl[@]"
Index: Completion/User/_perl_builtin_funcs
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_perl_builtin_funcs,v
retrieving revision 1.1.1.1
diff -u -F^( -r1.1.1.1 _perl_builtin_funcs
--- _perl_builtin_funcs	1999/09/05 22:04:03	1.1.1.1
+++ _perl_builtin_funcs	1999/09/14 00:10:49
@@ -12,13 +12,13 @@
   typeset -agU _perl_builtin_funcs
   local perlfunc
 
-  if perlfunc=`man -w perlfunc 2>&1`; then
+  if [[ -n "${perlfunc:=$(man -w perlfunc 2>/dev/null; print -l ${^manpath}/man1/perlfunc.1(N) {/usr/man,/usr/local/man}/man1/perlfunc.1(N))}" ]]; then
     _perl_builtin_funcs=( `perl -lne '
                              $in_funcs++, next if /Alphabetical/;     \
                              next unless $in_funcs;                   \
                              if (/^\.Ip "(\w+)/) {                    \
                                print $1 unless $func{$1}; $func{$1}++ \
-                             }' $perlfunc`
+                             }' $=perlfunc`
                )
   else
     echo "Couldn't find perlfunc man page; giving up."
-- 
Tanaka Akira



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