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

Re: PATCH: -d for everone (and misc.)



In article <199909151354.PAA32362@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> I forgot to say `... except for _cvs and _apt'.

Following patch modifies _apt and _cvs to use -d instead of -y.

Also, it modifies _describe to make it work without option for
compadd.

Index: Completion/Base/_describe
===================================================================
RCS file: /projects/zsh/zsh/Completion/Base/_describe,v
retrieving revision 1.1.1.1
diff -u -F^( -r1.1.1.1 _describe
--- _describe	1999/09/15 14:35:20	1.1.1.1
+++ _describe	1999/09/17 00:50:41
@@ -58,7 +58,7 @@
   (( nsets++ ))
   descr="$1"
   [[ -n "$showd" ]] && adescr=( "$adescr[@]" "${(@PM)^descr:#*:?*},$nsets" )
-  if [[ "$2" = -* ]]; then
+  if [[ $# = 1 || "$2" = -* ]]; then
     match=''
     shift
   else
Index: Completion/Debian/_apt
===================================================================
RCS file: /projects/zsh/zsh/Completion/Debian/_apt,v
retrieving revision 1.1.1.5
diff -u -F^( -r1.1.1.5 _apt
--- _apt	1999/09/14 00:20:36	1.1.1.5
+++ _apt	1999/09/17 00:50:42
@@ -54,7 +54,7 @@
   case \$current_option in
   ${comp_hasarg}esac"
 
-  local short_seq false true bool __bool_ intlevel word word1 nul
+  local short_seq false true bool bool_prefix intlevel word word1 nul
   local comp_bool comp_intlevel comp_configfile comp_arbitem comp_long comp_opt
   local regex_short regex_long regex_all
 
@@ -66,7 +66,7 @@
   true=(yes true with on enable)
   bool=($false $true)
 
-  __bool_=(--${^bool}-)
+  bool_prefix=(--${^bool}-)
 
   intlevel='[0-9]##'
 
@@ -82,36 +82,28 @@
   comp_short=\
 'if [[ $PREFIX = -'"$short_seq"' ]]; then
   _apt_consume_short ${PREFIX[2,-1]}
-  tmp1=(${${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?}#-})
-  if [[ $PREFIX = - ]]; then
-    compadd "$expl_opt[@]" - -${^tmp1}
-  else
-    tmp2=(-${^tmp1})
-    compadd "$expl_opt[@]" -y "($tmp2)" - ${PREFIX}${^tmp1}
-  fi
+  tmp1=(${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?})
+  tmp2=(${PREFIX}${^tmp1#-})
+  _describe -o option tmp1 tmp2
 elif [[ -z "$PREFIX" ]]; then
-  compadd "$expl_opt[@]" - ${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?}
+  tmp1=(${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?})
+  _describe -o option tmp1
 fi'
 
   comp_long=\
 'tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)options[(R)*~0]}}:#--*}#--}}"
 tmp2=(--${(M)^long_bool:#$~tmp1} --${(M)^long_intlevel:#$~tmp1})
-compadd "$expl_opt[@]" - $tmp2
-tmp2=(--${(M)^long_hasarg:#$~tmp1} --${(M)^long_configfile:#$~tmp1} --${(M)^long_arbitem:#$~tmp1})
-compadd "$expl_opt[@]" -S= - $tmp2
-compadd "$expl_opt[@]" -S "" - '"$__bool_"
+tmp3=(--${(M)^long_hasarg:#$~tmp1} --${(M)^long_configfile:#$~tmp1} --${(M)^long_arbitem:#$~tmp1})
+_describe -o option tmp2 -- tmp3 -S= -- bool_prefix -S ""'
 
   comp_long_prefix=\
 'tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)options[(R)*~0]}}:#--*}#--}}"
 tmp2=($_ra_left${(M)^long_bool:#$~tmp1} $_ra_left${(M)^long_intlevel:#$~tmp1})
-compadd "$expl_opt[@]" - $tmp2
-tmp2=($_ra_left${(M)^long_hasarg:#$~tmp1} $_ra_left${(M)^long_configfile:#$~tmp1} $_ra_left${(M)^long_arbitem:#$~tmp1})
-compadd "$expl_opt[@]" -S= - $tmp2
+tmp3=($_ra_left${(M)^long_hasarg:#$~tmp1} $_ra_left${(M)^long_configfile:#$~tmp1} $_ra_left${(M)^long_arbitem:#$~tmp1})
 tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)options[(R)*~0]}}:#-?}#-}}"
-tmp2=($_ra_left${(M)^short_bool:#$~tmp1} $_ra_left${(M)^short_intlevel:#$~tmp1})
-compadd "$expl_opt[@]" - $tmp2
-tmp2=($_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
-compadd "$expl_opt[@]" -S= - $tmp2'
+tmp2=("$tmp2[@]" $_ra_left${(M)^short_bool:#$~tmp1} $_ra_left${(M)^short_intlevel:#$~tmp1})
+tmp3=("$tmp3[@]" $_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
+_describe -o option tmp2 -- tmp3 -S='
 
   comp_opt='[[ -prefix - || -z "$compconfig[option_prefix]" || "$compconfig[option_prefix]" = *\!$words[1]* ]]'" && { $comp_short; $comp_long }"
 
@@ -321,6 +313,7 @@
 
     local short_hasarg short_bool short_intlevel short_configfile short_arbitem
     local long_hasarg long_bool long_intlevel long_configfile long_arbitem
+    local bool_prefix
     short_hasarg=($short_hasarg)
     short_bool=($short_bool)
     short_intlevel=($short_intlevel)
@@ -331,13 +324,14 @@
     long_intlevel=($long_intlevel)
     long_configfile=($long_configfile)
     long_arbitem=($long_arbitem)
+    bool_prefix=($bool_prefix)
 
     local expl_opt expl_bool expl_configfile
     _description expl_opt option
     _description expl_bool 'bool value'
     _description expl_configfile 'config file'
 
-    local current_option tmp1 tmp2
+    local current_option tmp1 tmp2 tmp3
 
     ${funcname}_sm
   }"
Index: Completion/User/_cvs
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_cvs,v
retrieving revision 1.1.1.10
diff -u -F^( -r1.1.1.10 _cvs
--- _cvs	1999/09/09 14:10:17	1.1.1.10
+++ _cvs	1999/09/17 00:50:42
@@ -227,7 +227,7 @@
 _cvs_history_x () {
   compset -P '*'
 
-  compadd "$@" -y '(
+  compadd "$@" -S '' -d '(
   F\ --\ release
   O\ --\ checkout
   E\ --\ export
-- 
Tanaka Akira



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