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

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



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

> I think it should be replaced by 'compadd "$PREFIX"'.

The patch is follows.

Also, I modified the completer for "cvs import" not to generate an
error without CVSROOT.

--- Completion/User/_cvs-	Wed Jul 21 23:58:01 1999
+++ Completion/User/_cvs	Thu Jul 22 00:08:46 1999
@@ -1,5 +1,7 @@
 #compdef cvs
 
+setopt localoptions extendedglob
+
 typeset -A commands
 commands=(add "ad new"            admin "adm rcs"         annotate ann
           checkout "co get"       commit "ci com"         diff "di dif"
@@ -55,7 +57,12 @@
       ;;
     import|im|imp) # "+Qqdb:m:I:k:W:"
       _complete_opts Q '' q '' d '' b: '' m: "$complete_m" I: '' k: "$complete_k" W: '' || case $[CURRENT-com] in
-	1) compgen -X "Enter repository name" -W $CVSROOT -g '*~*CVSROOT(/)' -s '';;
+	1) if [[ "${+CVSROOT}" == 1 && "$CVSROOT" != :* ]]; then
+	     compgen -X "Enter repository name" -W "$CVSROOT" -g '*~*CVSROOT(/)' -s ''
+	   else
+	     compadd -UX "Enter repository name" -n '' && eval "$showhint"
+	   fi
+	   ;;
 	2) compadd -UX "Enter vendor tag name" -n '' && eval "$showhint";;
 	3) compadd -UX "Enter release tag name" -n '' && eval "$showhint";;
 	*) compadd -UX "No futher arguments used" -n '' && eval "$showhint";;
--- Completion/Base/_complete_opts-	Thu Jul 22 00:32:33 1999
+++ Completion/Base/_complete_opts	Thu Jul 22 00:33:03 1999
@@ -18,7 +18,7 @@
 case "${#no_arg}-${#with_arg}" in
   0-0)
     if [[ x$PREFIX = x-* ]]; then
-      compgen -k '()'			# What does this accomplish?
+      compadd - "$PREFIX"
     else
       done=''
     fi

-- 
Tanaka Akira



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