zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@jaist.ac.jp>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Re: CVS completer (Re: PATCH: Re: Completion/User functions again)
Date: 29 Jul 1999 01:05:13 +0900	[thread overview]
Message-ID: <rsqzp0gbw06.fsf@crane.jaist.ac.jp> (raw)
In-Reply-To: Tanaka Akira's message of "27 Jul 1999 23:11:41 +0900"

In article <rsqwvvmdvxe.fsf@crane.jaist.ac.jp>,
  Tanaka Akira <akr@jaist.ac.jp> writes:

> I found a problem of return status of _cvstargets, etc.

Hm. When entries has just one elements, the argument such as
'(_cvs)' is supplied to compgen -g and it is treated as glob
qualifiers. The completer should not use parenthesises in this case.

This patch also tries to complete arguments for some options.

--- Completion/User/_cvs	Wed Jul 28 14:37:08 1999
+++ Completion/User/_cvs	Wed Jul 28 14:45:23 1999
@@ -35,16 +35,17 @@
 	_cvstargets
 	;;
       annotate|ann) # "+lr:D:fR"
-	_complete_opts l '' r: '' D: '' f '' R '' || _cvstargets
+	_complete_opts l '' r: "$complete_r" D: "$complete_D" f '' R '' ||
+	_cvstargets
 	;;
       checkout|co|get) # "+ANnk:d:flRpQqcsr:D:j:P"
-	_complete_opts A '' N '' n '' k: "$complete_k" d: '' f '' l '' R ''\
-	  p '' Q '' q '' c '' s '' r: "$complete_r" D: "$complete_D" j: '' \
-	  P '' ||
+	_complete_opts A '' N '' n '' k: "$complete_k" d: '_files -/' f '' \
+	  l '' R '' p '' Q '' q '' c '' s '' r: "$complete_r" D: "$complete_D" \
+	  j: "$complete_r" P '' ||
 	_cvsrepositories
 	;;
       commit|ci|com) # "+nlRm:fF:r:"
-	_complete_opts n '' l '' R '' m: "$complete_m" f '' F: '' \
+	_complete_opts n '' l '' R '' m: "$complete_m" f '' F: _files \
 	  r: "$complete_r" ||
 	_cvstargets_modified
 	;;
@@ -56,15 +57,15 @@
 	_cvstargets_modified || _cvstargets
 	;;
       edit) # "+lRa:"
-	_complete_opts l '' R '' a: '' || _cvstargets
+	_complete_opts l '' R '' a: 'compadd edit unedit commit all none' ||
+	_cvstargets
 	;;
       editors) # "+lR"
 	_complete_opts l '' R '' || _cvstargets
 	;;
-      export|exp|ex) # "+ANnk:d:flRpQqcsr:D:j:P"
-	_complete_opts A '' N '' n '' k: "$complete_k" d: '' f '' l '' R '' \
-	  p '' Q '' q '' c '' s '' r: "$complete_r" D: "$complete_D" j: '' \
-	  P '' ||
+      export|exp|ex) # "+Nnk:d:flRQqr:D:"
+	_complete_opts N '' n '' k: "$complete_k" d: '_files -/' f '' l '' \
+	  R '' Q '' q '' r: "$complete_r" D: "$complete_D" ||
 	_cvsrepositories
 	;;
       history|hi|his) # "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:"
@@ -74,7 +75,7 @@
 	_cvstargets
 	;;
       import|im|imp) # "+Qqdb:m:I:k:W:"
-	_complete_opts Q '' q '' d '' b: '' m: "$complete_m" I: '' \
+	_complete_opts Q '' q '' d '' b: '' m: "$complete_m" I: _files \
 	  k: "$complete_k" W: '' ||
 	case $[CURRENT-com] in
 	  1) _cvsrepositories;;
@@ -113,8 +114,8 @@
 	;;
       update|up|upd) # "+ApPflRQqduk:r:D:j:I:W:"
 	_complete_opts A '' p '' P '' f '' l '' R '' Q '' q '' d '' u '' \
-	  k: "$complete_k" r: "$complete_r" D: "$complete_D" j: '' I: '' \
-	  W: '' ||
+	  k: "$complete_k" r: "$complete_r" D: "$complete_D" j: "$complete_r" \
+	  I: '' W: '' ||
 	_cvstargets
 	;;
       watch)
@@ -126,7 +127,9 @@
 	      _complete_opts l '' R '' || _cvstargets
 	      ;;
 	    add|remove) # "+lRa:"
-	      _complete_opts l '' R '' a: '' || _cvstargets
+	      _complete_opts l '' R '' \
+	        a: 'compadd edit unedit commit all none' || \
+	      _cvstargets
 	      ;;
 	  esac
 	fi
@@ -247,11 +250,11 @@
 _cvsdirs () {
   if [[ -d ${pref}CVS ]]; then
     _cvsdirentries
-    if (( $#entries )); then
-      compgen "$@" -g '('${(j:|:)entries:q}')'
-    else
-      false
-    fi
+    case $#entries in
+      0) false;;
+      1) compgen "$@" -g "${entries:q}";;
+      *) compgen "$@" -g '('${(j:|:)entries:q}')';;
+    esac
   else
     _files
   fi
@@ -262,11 +265,11 @@
   _cvsprefix
   if [[ -d ${pref}CVS ]]; then
     _cvsentries
-    if (( $#entries )); then
-      compgen -g '('${(j:|:)entries:q}')'
-    else
-      false
-    fi
+    case $#entries in
+      0) false;;
+      1) compgen -g "${entries:q}";;
+      *) compgen -g '('${(j:|:)entries:q}')';;
+    esac
   else
     _files
   fi
@@ -277,11 +280,11 @@
   _cvsprefix
   if [[ -d ${pref}CVS ]]; then
     _cvsentries_modified
-    if (( $#entries )); then
-      compgen -g '('${(j:|:)entries:q}')'
-    else
-      false
-    fi
+    case $#entries in
+      0) false;;
+      1) compgen -g "${entries:q}";;
+      *) compgen -g '('${(j:|:)entries:q}')';;
+    esac
   else
     _files 
   fi
-- 
Tanaka Akira


  reply	other threads:[~1999-07-28 16:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-21 11:27 Sven Wischnowsky
1999-07-21 12:35 ` Tanaka Akira
1999-07-21 15:43   ` Tanaka Akira
1999-07-21 15:54 ` Bart Schaefer
1999-07-25  9:23   ` Tanaka Akira
1999-07-25 11:38     ` Tanaka Akira
1999-07-26  4:48     ` Tanaka Akira
1999-07-26 16:26       ` Tanaka Akira
1999-07-26 17:10         ` Tanaka Akira
1999-07-27  7:48           ` PATCH: " Bart Schaefer
1999-07-27  8:12             ` Peter Stephenson
1999-07-27 10:07             ` Tanaka Akira
1999-07-27 11:45               ` Tanaka Akira
1999-07-27 13:49                 ` Bart Schaefer
1999-07-27 13:58                   ` Tanaka Akira
1999-07-27 14:11                     ` Tanaka Akira
1999-07-28 16:05                       ` Tanaka Akira [this message]
1999-07-27  8:15           ` Peter Stephenson
1999-07-27  8:58             ` Tanaka Akira
1999-08-02  9:47 PATCH: " Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=rsqzp0gbw06.fsf@crane.jaist.ac.jp \
    --to=akr@jaist.ac.jp \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).