From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: completion
Date: Wed, 25 Aug 1999 10:24:49 +0200 (MET DST) [thread overview]
Message-ID: <199908250824.KAA10555@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 25 Aug 1999 00:56:54 +0900
Tanaka Akira wrote:
> In article <199908231346.PAA03326@beta.informatik.hu-berlin.de>,
> Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:
>
> > '-opt:*::descr:action' # all args to the option
>
> Does this require the actual option?
It did. I wanted to allow this for the `rest arguments', too, and then
forgot to write it (again). Sorry.
The syntax is, of course: `*::descr:action'.
The patch also contains a hunk for `_vars_eq', making it use default
completion after the equal sign.
Bye
Sven
diff -u od/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- od/Zsh/compsys.yo Mon Aug 23 15:47:49 1999
+++ Doc/Zsh/compsys.yo Wed Aug 25 10:19:54 1999
@@ -902,6 +902,11 @@
This describes how arguments are to be completed for which no
description with one of the first two forms was given. This also means
that any number of arguments can be completed.
+
+If there are two colons before the message (as in
+`tt(*::)var(message)tt(:)var(action)') the tt(words) special array and
+the tt(CURRENT) special parameter will be restricted to only the
+normal arguments when the var(Action) is executed or evaluated.
)
item(var(opt-spec)[var(description) ...])(
This describes an option and (if at least one var(description) is
diff -u -r oc/Base/_arguments Completion/Base/_arguments
--- oc/Base/_arguments Tue Aug 24 11:13:33 1999
+++ Completion/Base/_arguments Wed Aug 25 10:21:05 1999
@@ -7,7 +7,7 @@
local long args rest ws cur nth def nm expl descr action opt arg tmp
local single uns ret=1 soptseq soptseq1 sopts prefix line
-local beg optbeg argbeg
+local beg optbeg argbeg nargbeg inopt
# Associative arrays used to collect information about the options.
@@ -82,6 +82,16 @@
opts[$tmp]=''
fi
unset "oneshot[$tmp]"
+ elif [[ "$1" = \*::* ]]; then
+
+ # This is `*:...', describing `all other arguments', with argument
+ # range restriction.
+
+ if [[ "$1" = \*:::* ]]; then
+ rest="*${1[3,-1]}"
+ else
+ rest="$1"
+ fi
elif [[ "$1" = \*:* ]]; then
# This is `*:...', describing `all other arguments'.
@@ -125,8 +135,9 @@
nth=1
line=( "$words[1]" )
beg=2
-argbeg=2
-optbeg=2
+argbeg=1
+optbeg=1
+nargbeg=1
# ...until the current word is reached.
@@ -190,6 +201,7 @@
def="$opts[$ws[1]]"
optbeg="$beg"
argbeg="$beg"
+ inopt=yes
[[ -n "$oneshot[$ws[1]]" ]] && unset "opts[$ws[1]]"
else
uns=''
@@ -199,6 +211,7 @@
def="$opts[$tmp]"
optbeg="$beg"
argbeg="$beg"
+ inopt=yes
uns="${ws[1][2,-1]}"
opt=''
fi
@@ -242,6 +255,7 @@
[[ -n "$oneshot[$tmp[1]]" ]] && unset "dopts[$tmp[1]]"
if [[ "$def" = [^*]*[^\\]:*[^\\]:* ]]; then
def="${def#?*[^\\]:*[^\\]:}"
+ inopt=yes
else
def=''
fi
@@ -279,6 +293,7 @@
def="${def#?*[^\\]:*[^\\]:}"
optbeg="$beg"
argbeg="$beg"
+ inopt=yes
else
def=''
fi
@@ -303,6 +318,8 @@
if [[ -n "$opt" && -n "$arg" ]]; then
def=''
line=( "$line[@]" "$ws[1]" )
+ [[ -n "$inopt" ]] && nargbeg=$(( beg - 1 ))
+ inopt=''
(( nth++ ))
fi
fi
@@ -313,6 +330,8 @@
(( beg++ ))
done
+[[ -n "$inopt" ]] && nargbeg="$beg"
+
# Now generate the matches.
if [[ $#long -ne 0 && "$PREFIX" = --* ]]; then
@@ -339,12 +358,10 @@
# If we have none at all, use the one for this argument position.
def="$args[nth]"
- [[ -z "$def" ]] && def="$rest"
-
- if [[ "$def" = \** ]]; then
- def="${def#*[^\\]:}"
- [[ "$def" = :* ]] && def="$def[2,-1]"
- [[ "$def" = :* ]] && def="$def[2,-1]"
+ if [[ -z "$def" ]]; then
+ def="$rest"
+ optbeg="$nargbeg"
+ argbeg="$nargbeg"
fi
fi
@@ -456,6 +473,8 @@
def="$def[2,-1]"
beg=$optbeg
fi
+
+ [[ beg -ge $#words ]] && beg=$(( $#words - 1 ))
shift beg words
(( CURRENT -= beg ))
diff -u -r oc/Builtins/_vars_eq Completion/Builtins/_vars_eq
--- oc/Builtins/_vars_eq Tue Aug 24 11:13:35 1999
+++ Completion/Builtins/_vars_eq Wed Aug 25 09:08:07 1999
@@ -1,3 +1,7 @@
#compdef declare export integer local readonly typeset
-_parameters -q -S '='
+if compset -P '*='; then
+ _default
+else
+ _parameters -q -S '='
+fi
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-08-25 8:26 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-25 8:24 Sven Wischnowsky [this message]
1999-08-26 10:54 ` Tanaka Akira
-- strict thread matches above, loose matches on Subject: below --
2000-02-21 9:50 Sven Wischnowsky
1999-10-28 8:12 Sven Wischnowsky
1999-10-28 6:58 Sven Wischnowsky
1999-10-27 8:42 Sven Wischnowsky
1999-10-27 16:39 ` Bart Schaefer
1999-10-27 7:14 Sven Wischnowsky
1999-10-27 21:26 ` Tanaka Akira
1999-10-26 13:17 Sven Wischnowsky
1999-10-26 13:01 Oliver Kiddle
1999-10-26 13:35 ` Zefram
1999-10-26 11:03 Sven Wischnowsky
1999-10-26 17:17 ` Bart Schaefer
1999-10-26 17:22 ` Tanaka Akira
1999-10-26 17:32 ` Tanaka Akira
1999-08-30 9:30 Sven Wischnowsky
1999-08-27 7:03 Sven Wischnowsky
1999-08-27 8:29 ` Tanaka Akira
1999-08-28 6:01 ` Tanaka Akira
1999-08-26 13:52 Sven Wischnowsky
1999-08-26 12:20 Sven Wischnowsky
1999-08-26 13:17 ` Tanaka Akira
1999-08-26 17:56 ` Tanaka Akira
1999-08-25 12:57 Sven Wischnowsky
1999-08-25 12:54 Sven Wischnowsky
1999-08-24 10:43 Sven Wischnowsky
1999-08-25 1:56 ` Tanaka Akira
1999-08-24 9:12 Sven Wischnowsky
1999-08-24 10:04 ` Tanaka Akira
1999-08-23 13:46 Sven Wischnowsky
1999-08-23 16:16 ` Tanaka Akira
1999-08-24 15:56 ` Tanaka Akira
1999-08-23 12:00 Sven Wischnowsky
1999-08-23 9:32 Sven Wischnowsky
1999-08-23 10:54 ` Tanaka Akira
1999-08-20 12:59 Sven Wischnowsky
1999-08-20 23:22 ` Tanaka Akira
1999-08-21 8:39 ` Tanaka Akira
1999-08-21 17:47 ` Tanaka Akira
1999-08-20 7:42 Sven Wischnowsky
1999-08-19 13:59 Sven Wischnowsky
1999-08-19 10:44 Sven Wischnowsky
1999-08-19 14:38 ` Tanaka Akira
1999-08-24 13:46 ` Peter Stephenson
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=199908250824.KAA10555@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--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).