Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: completion
- X-seq: zsh-workers 7500
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: completion
- Date: Thu, 26 Aug 1999 14:20:11 +0200 (MET DST)
- In-reply-to: Tanaka Akira's message of 26 Aug 1999 19:54:09 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Tanaka Akira wrote:
>
> ...
>
> cvs common options such as --version are completed addition to options
> for cvs diff.
>
> ...
>
> is27e1u11% cvs -e vi
> unknown cvs command: -e
> option
> --allow-root= -H -f -t
> --help -Q -l -v
> --help-commands -T -n -w
> --help-options -a -q -x
> --help-synonyms -b -r -z
> --version -d -s
>
> _arguments does not cutoff words in this case. Hm.
Should be fixed by this patch. I also changed the `commands'
parameter's name to `cmds' -- until we find the final solution (hope
that's ok for you).
And then I forgot all those `*'s in `_find'... ahem. I'm so ashamed.
Bye
Sven
diff -u -r oc/Base/_arguments Completion/Base/_arguments
--- oc/Base/_arguments Thu Aug 26 14:06:15 1999
+++ Completion/Base/_arguments Thu Aug 26 14:02:46 1999
@@ -226,7 +226,11 @@
def="$opts[$ws[1]]"
optbeg="$beg"
argbeg="$beg"
- inopt=yes
+ if [[ -n "$def" ]]; then
+ inopt=yes
+ else
+ inopt=''
+ fi
[[ -n "$oneshot[$ws[1]]" ]] && unset "opts[$ws[1]]"
else
uns=''
@@ -236,7 +240,11 @@
def="$opts[$tmp]"
optbeg="$beg"
argbeg="$beg"
- inopt=yes
+ if [[ -n "$def" ]]; then
+ inopt=yes
+ else
+ inopt=''
+ fi
uns="${ws[1][2,-1]}"
opt=''
fi
@@ -283,6 +291,7 @@
inopt=yes
else
def=''
+ inopt=''
fi
fi
fi
@@ -318,11 +327,15 @@
def="${def#?*[^\\]:*[^\\]:}"
optbeg="$beg"
argbeg="$beg"
- inopt=yes
else
def=''
fi
fi
+ if [[ -n "$def" ]]; then
+ inopt=yes
+ else
+ inopt=''
+ fi
fi
fi
@@ -453,7 +466,7 @@
(( $#tmp )) && unset "$tmp[@]"
fi
- if [[ -n "$opt" ]]; then
+ if [[ -n "$opt" && "$def" != \** ]]; then
# We aren't in an argument directly after a option name, so
# all option names are possible matches.
diff -u -r oc/Cvs/_cvs_command Completion/Cvs/_cvs_command
--- oc/Cvs/_cvs_command Thu Aug 26 14:06:17 1999
+++ Completion/Cvs/_cvs_command Thu Aug 26 14:04:46 1999
@@ -1,18 +1,18 @@
#autoload
-typeset -A commands
-commands=(add "ad new" admin "adm rcs" annotate ann
- checkout "co get" commit "ci com" diff "di dif"
- edit "" editors "" export "exp ex"
- history "hi his" import "im imp" init ""
- log "lo rlog" login "logon lgn" logout ""
- rdiff patch release "re rel" remove "rm delete"
- status "st stat" rtag "rt rfreeze" tag "ta freeze"
- unedit "" update "up upd" watch ""
- watchers "")
+typeset -A cmds
+cmds=(add "ad new" admin "adm rcs" annotate ann
+ checkout "co get" commit "ci com" diff "di dif"
+ edit "" editors "" export "exp ex"
+ history "hi his" import "im imp" init ""
+ log "lo rlog" login "logon lgn" logout ""
+ rdiff patch release "re rel" remove "rm delete"
+ status "st stat" rtag "rt rfreeze" tag "ta freeze"
+ unedit "" update "up upd" watch ""
+ watchers "")
if (( CURRENT == 1 )); then
- compadd ${(k)commands} || compadd ${(kv)=commands}
+ compadd ${(k)cmds} || compadd ${(kv)=cmds}
else
case "$words[1]" in
add|ad|new) _cvs_add;;
diff -u -r oc/User/_find Completion/User/_find
--- oc/User/_find Thu Aug 26 11:29:02 1999
+++ Completion/User/_find Thu Aug 26 13:41:51 1999
@@ -1,59 +1,59 @@
#compdef find
_arguments \
- '-daystart' \
- '-depth' \
- '-follow' \
- '-help' \
- '-maxdepth:maximum search depth:' \
- '-mindepth:minimum search depth:' \
- '-mount' \
- '-noleaf' \
- '-version' \
- '-xdev' \
- '-amin:access time (minutes):' \
- '-cmin:inode change time (minutes):' \
- '-mmin:modification time (minutes):' \
- '-atime:access time (days):' \
- '-ctime:inode change time (days):' \
- '-mtime:modification time (days):' \
- '-anewer:file to compare (access time):_files' \
- '-cnewer:file to compare (inode change time):_files' \
- '-newer:file to compare (modification time):_files' \
- '-used:access after inode change (days):' \
- '-empty' \
- '-false' \
- '-fstype:filesystem type:(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' \
- '-gid:numeric group ID:' \
- '-group:group:_groups' \
- '-uid:numeric user ID:' \
- '-user:user:_users' \
- '-lname:link pattern to search:' \
- '-ilname:link pattern to search (case insensitive):' \
- '-name:name pattern to search:' \
- '-iname:name pattern to search (case insensitive):' \
- '-path:path pattern to search:' \
- '-ipath:path pattern to search (case insensitive):' \
- '-regex:regular expression to search:' \
- '-iregex:regular expression to search (case insensitive):' \
- '-inum:inode number:' \
- '-links:number of links:' \
- '-nouser' \
- '-nogroup' \
- '-perm:file permission bits:' \
- '-size:file size:' \
- '-true' \
- '-type:file type:(b c d p f l s)' \
- '-xtype:file type:(b c d p f l s)' \
- '-exec:program: _command_names -e:*\;::program arguments: _normal' \
- '-ok:program: _command_names -e:*\;::program arguments: _normal' \
- '-fls:output file:_files' \
- '-fprint:output file:_files' \
- '-fprint0:output file:_files' \
- '-fprintf:output file:_files:output format:' \
- '-print' \
- '-print0' \
- '-printf:output format:' \
- '-prune' \
- '-ls' \
+ '*-daystart' \
+ '*-depth' \
+ '*-follow' \
+ '*-help' \
+ '*-maxdepth:maximum search depth:' \
+ '*-mindepth:minimum search depth:' \
+ '*-mount' \
+ '*-noleaf' \
+ '*-version' \
+ '*-xdev' \
+ '*-amin:access time (minutes):' \
+ '*-cmin:inode change time (minutes):' \
+ '*-mmin:modification time (minutes):' \
+ '*-atime:access time (days):' \
+ '*-ctime:inode change time (days):' \
+ '*-mtime:modification time (days):' \
+ '*-anewer:file to compare (access time):_files' \
+ '*-cnewer:file to compare (inode change time):_files' \
+ '*-newer:file to compare (modification time):_files' \
+ '*-used:access after inode change (days):' \
+ '*-empty' \
+ '*-false' \
+ '*-fstype:filesystem type:(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' \
+ '*-gid:numeric group ID:' \
+ '*-group:group:_groups' \
+ '*-uid:numeric user ID:' \
+ '*-user:user:_users' \
+ '*-lname:link pattern to search:' \
+ '*-ilname:link pattern to search (case insensitive):' \
+ '*-name:name pattern to search:' \
+ '*-iname:name pattern to search (case insensitive):' \
+ '*-path:path pattern to search:' \
+ '*-ipath:path pattern to search (case insensitive):' \
+ '*-regex:regular expression to search:' \
+ '*-iregex:regular expression to search (case insensitive):' \
+ '*-inum:inode number:' \
+ '*-links:number of links:' \
+ '*-nouser' \
+ '*-nogroup' \
+ '*-perm:file permission bits:' \
+ '*-size:file size:' \
+ '*-true' \
+ '*-type:file type:(b c d p f l s)' \
+ '*-xtype:file type:(b c d p f l s)' \
+ '*-exec:program: _command_names -e:*\;::program arguments: _normal' \
+ '*-ok:program: _command_names -e:*\;::program arguments: _normal' \
+ '*-fls:output file:_files' \
+ '*-fprint:output file:_files' \
+ '*-fprint0:output file:_files' \
+ '*-fprintf:output file:_files:output format:' \
+ '*-print' \
+ '*-print0' \
+ '*-printf:output format:' \
+ '*-prune' \
+ '*-ls' \
'*:directory:_files -/'
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author