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

Re: CVS completer (Re: PATCH: Re: Completion/User functions again)



In article <rsqvhb9ulqj.fsf@xxxxxxxxxxxxxxxxx>,
  Tanaka Akira <akr@xxxxxxxxxxx> writes:

> Most of codes to handle CVS/* are taken from Misc/compctl-examples.

This refines it.

--- Completion/User/_cvsaddp-	Mon Jul 26 13:43:26 1999
+++ Completion/User/_cvsaddp	Mon Jul 26 13:43:42 1999
@@ -5,8 +5,9 @@
 _cvsentries
 setopt localoptions unset
 local all omit
-all=( ${pref}*(D) )
-omit=( $entries ${pref}${^${=cvsignore}} )
-[[ -r ~/.cvsignore ]] && omit=( $omit ${pref}${^$(<~/.cvsignore)} )
-[[ -r ${pref}.cvsignore ]] && omit=( $omit ${pref}${^$(<${pref}.cvsignore)} )
-eval 'compadd - ${all:#('${(j:|:)omit}')}' 
+all=( ${pref}*~${pref}CVS(D:t) )
+omit=( $entries ${=cvsignore} )
+[[ -r ~/.cvsignore ]] && omit=( $omit $(<~/.cvsignore) )
+[[ -r ${pref}.cvsignore ]] && omit=( $omit $(<${pref}.cvsignore) )
+eval 'compadd -fp "$pref" - ${all:#('${(j:|:)omit}')}' ||
+  compadd -fp "$pref" - ${pref}*~${pref}CVS(/:t)
--- Completion/User/_cvsentries-	Mon Jul 26 13:43:26 1999
+++ Completion/User/_cvsentries	Mon Jul 26 13:43:42 1999
@@ -2,6 +2,6 @@
 
 setopt localoptions nullglob unset
 if [[ -f ${pref}CVS/Entries ]]; then
-    entries=( "${pref}${(@)^${(@)${(@)${(f@)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}" )
+    entries=( "${(@)${(@)${(@)${(f@)$(<${pref}CVS/Entries)}:#D}#(D|)/}%%/*}" )
 fi
 
--- Completion/User/_cvsprefix-	Mon Jul 26 13:43:27 1999
+++ Completion/User/_cvsprefix	Mon Jul 26 13:43:42 1999
@@ -2,10 +2,15 @@
 
 local f
 pref=$PREFIX
-if [[ -d $pref:h && ! -d $pref ]]; then
+if [[ $pref != */ ]]; then
+  if [[ $pref = */* ]]; then
     pref=$pref:h
-elif [[ $pref != */* ]]; then
+  else
     pref=
+  fi
+fi
+if [[ ! -d "$pref" ]]; then
+  pref=
 fi
 [[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
 
--- Completion/User/_cvsremovep-	Mon Jul 26 13:43:27 1999
+++ Completion/User/_cvsremovep	Mon Jul 26 13:43:42 1999
@@ -5,5 +5,7 @@
 _cvsentries
 setopt localoptions unset
 local omit
-omit=( ${pref}*(D) )
-eval 'compadd - ${entries:#('${(j:|:)omit}')}'
+omit=( ${pref}*(D:t) )
+eval 'compadd -fp "$pref" - ${entries:#('${(j:|:)omit}')}' ||
+  compadd -fp "$pref" - ${pref}*~${pref}CVS(/:t)
+
--- Completion/User/_cvstargets-	Mon Jul 26 13:43:27 1999
+++ Completion/User/_cvstargets	Mon Jul 26 13:43:42 1999
@@ -4,6 +4,4 @@
 _cvsprefix
 _cvsentries
 
-compadd - $entries
-
-compgen -g "^CVS(/)"
+compadd -fp "$pref" - $entries

-- 
Tanaka Akira



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