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

Re: PATCH: Re: cvs completion does not support partial path completion



On May 4,  5:16am, Bart Schaefer wrote:
} Subject: PATCH: Re: cvs completion does not support partial path completio
}
} The following seems to give the desired behavior for the most part.  It
} does partial-path completion as far as possible, then stops leaving the
} trailing file name uncompleted.  Press TAB again, and it completes the
} final part by examining the CVS/Entries file as usual.

Here's the patch as I actually plan to commit it.  In addition to the
problem with the empty message-part of the _arguments spec, I found that
it didn't complete properly in the middle of a word.

Index: Completion/Unix/Command/_cvs
===================================================================
--- Completion/Unix/Command/_cvs	2001/04/09 20:14:09	1.1.1.1
+++ Completion/Unix/Command/_cvs	2001/05/04 16:33:59
@@ -73,7 +73,7 @@
   _arguments -s \
     '-k+[keyword]:keyword substitution:_cvs_k' \
     '-m+[message]:message:_cvs_m' \
-    '*:file:_cvs_files_unmaintained' \
+    '*:added file:_cvs_files_unmaintained' \
 }
 
 (( $+functions[_cvs_admin] )) ||
@@ -157,7 +157,7 @@
     '(-F)-m+[message]:message:_cvs_m' \
     '(-m)-F+[message file]:log message file:_files' \
     '-r+[specify revision]:tag:_cvs_revisions' \
-    '*:file:_cvs_files_modified'
+    '*:modified file:_cvs_files_modified'
 }
 
 (( $+functions[_cvs_diff] )) ||
@@ -434,7 +434,7 @@
     '-f[force to remove]' \
     '(-R)-l[don'\''t recursive]' \
     '(-l)-R[recursive]' \
-    '*:file:_cvs_remove_arg'
+    '*:removed file:_cvs_remove_arg'
 }
 
 (( $+functions[_cvs_remove_arg] )) ||
@@ -516,7 +516,7 @@
     '(-D)-r+[specify revision]:tag:_cvs_revisions' \
     '(-r)-D+[specify date]:date:_cvs_D' \
     '-j+[merge]:tag:_cvs_revisions' \
-    '*-I+[ignore files]:name:_files' \
+    '*-I+[ignore files]:file:_files' \
     '*-W+[wrapper specification]:spec:_files' \
     '*:file:_cvs_files'
 }
@@ -856,7 +856,8 @@
 (( $+functions[_cvs_existing_directories] )) ||
 _cvs_existing_directories () {
   local expl
-  _wanted files expl file _path_files -g "*~(*/|)CVS(/)"
+  _wanted directories expl directory _path_files -g "*~(*/|)CVS(/)" ||
+  _cvs_path_prefixes
 }
 
 (( $+functions[_cvs_existing_entries] )) ||
@@ -881,7 +882,7 @@
     realdir=${(e)~linedir}
     [[ -f "$realdir"CVS/Entries ]] &&
     [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
-    _wanted files expl file _path_files -g "$pat"
+    _wanted files expl 'modified file' _path_files -g "$pat"
   else
     _cvs_existing_entries
   fi
@@ -945,7 +946,20 @@
       ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}}
     )
     compquote files
-    _wanted files expl file compadd -Qp "$linedir" -a files
+    _wanted files expl 'removed file' compadd -Qp "$linedir" -a files
+  }
+}
+
+(( $+functions[_cvs_path_prefixes] )) ||
+_cvs_path_prefixes () {
+  local expl match
+  match=()
+  [[ "$PREFIX$SUFFIX" = (#b)(*)(/[^/]#) ]] && {
+    PREFIX="$match[1]"
+    ISUFFIX="$match[2]$ISUFFIX"
+    SUFFIX=''
+    _wanted directories expl directory \
+	_path_files -g "*~($PREFIX|(*/|)CVS)(/)" -S ''
   }
 }
 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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