* Re: 3.1.6-pws-3
@ 1999-09-06 11:50 Sven Wischnowsky
1999-09-06 18:11 ` _rpm fixes Adam Spiers
0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 1999-09-06 11:50 UTC (permalink / raw)
To: zsh-workers
Peter Stephenson wrote:
> There were some minor typo fixes in the completion functions which I didn't
> post. The last change to compsys.yo from Sven had quite a large offset, so
> I may have missed something. I've deleted Completion/Rpm since we now have
> Completion/Linux/_rpm (this is going to make for great fun if we start
> using CVS). Ideally people introducing such subdirectories should find
> some configure test (e.g. $host_os) for whether to include it, add it in
> the obvious place in configure.in where Zftp is added, and document this in
> INSTALL. (This is all somewhere a good package mechanism could make a
> difference.)
I agree that in the end we should have configure tests for all this,
but for this example (`_rpm') I wouldn't have the slightest idea how
to test (other then testing if `rpm' is available). I wasn't even sure
if `Linux' is ok. Maybe it should be put in `Redhat'. Or `Linux/Redhat'.
Or `User/Linux/Redhat', next to `User/Linux/Debian'.
Also: what if this is installed in a heterogeneous network where the
sysadmin installs `/usr/local/lib/zsh/...' (or something like that)
from a Solaris box but there are also Linux boxes in the net?
I think I would prefer to leave that to run-time configuration (on a
per-user or per-/etc/zsh* basis). With a good package-system, that
is. With packages and sub-packages, and...
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* _rpm fixes
1999-09-06 11:50 3.1.6-pws-3 Sven Wischnowsky
@ 1999-09-06 18:11 ` Adam Spiers
0 siblings, 0 replies; 7+ messages in thread
From: Adam Spiers @ 1999-09-06 18:11 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
>
> Peter Stephenson wrote:
>
> > There were some minor typo fixes in the completion functions which I didn't
> > post.
Did you get this one? I also fixed -b to complete .spec files. It
was completing installed rpms before for some reason.
diff -urN -x *~ zsh-3.1.6-4/Completion/Linux/_rpm zsh-3.1.6-adam/Completion/Linux/_rpm
--- zsh-3.1.6-4/Completion/Linux/_rpm Mon Sep 6 13:15:25 1999
+++ zsh-3.1.6-adam/Completion/Linux/_rpm Mon Sep 6 18:28:24 1999
@@ -44,7 +44,7 @@
# Used by `_arguments', made local here.
local state lstate line
-tyeset -A options
+typeset -A options
state=''
@@ -139,7 +139,7 @@
'*:RPM package:->package' && ret=0
;;
build_b)
- tmp=( '*:RPM package:->package' )
+ tmp=( '*:spec file:_files -g \*.spec' )
;&
build_t)
(( $#tmp )) || tmp=( '*:tar file:_files -g \*.\(\#i\)tar\(.\*\|\)' )
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: _rpm fixes
@ 1999-09-08 11:27 Sven Wischnowsky
0 siblings, 0 replies; 7+ messages in thread
From: Sven Wischnowsky @ 1999-09-08 11:27 UTC (permalink / raw)
To: zsh-workers
Sorry...
Bye
Sven
diff -u oldcompletion/Linux/_rpm Completion/Linux/_rpm
--- oldcompletion/Linux/_rpm Wed Sep 8 13:26:20 1999
+++ Completion/Linux/_rpm Wed Sep 8 13:26:24 1999
@@ -121,7 +121,6 @@
;&
install)
(( $#tmp )) || tmp=(-i)
-#set -x
_arguments -s "$tmp[@]" \
'*-v' \
'--rcfile:resource file:_files' \
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: _rpm fixes
@ 1999-09-08 11:25 Sven Wischnowsky
0 siblings, 0 replies; 7+ messages in thread
From: Sven Wischnowsky @ 1999-09-08 11:25 UTC (permalink / raw)
To: zsh-workers
Adam Spiers wrote:
> Adam Spiers, on thelonious (adam@thelonious.new.ox.ac.uk) wrote:
> > Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> > > I don't know `rpm' very well and the documentation I have is very
> > > imprecise, that's why I was asking for help when I first sent the
> > > `Rpm/*' functions.
> > >
> > > Is the rest of the function ok?
> >
> > I haven't played with it much yet (still discovering the joys of all
> > the bells and whistles with the new completion system,
> > e.g. description_format with group_matches, which is GREAT!) but I use
> > rpm a fair bit so of course I'll fix any more problems I find.
>
> Well, at least, I would if I knew how to...
>
> Next problem: rpm allows single letter switches to be grouped, but
> _rpm doesn't recognise this, e.g.
>
> % rpm -ihv <TAB>
>
> doesn't complete .rpm files.
>
> Presumably the -s of _arguments will help here, but how do you use it
> without mucking up all the long options? Two separate calls to
> _arguments?
No, `_arguments' has quite a bit of magic built in. One can use `-s'
together with long options without problems. `_rpm' describes a
`-pipe' option and even that seems to work (btw. is that correct, or
is the option really named `--pipe').
About the completion of `rpm -ihv': this is a bit of a problem,
because the first call to `_arguments' has to handle the `-i' and the
secoand call has to handle the rest of the line. The patch tries to
achieve this by using `-i+:*:...' on the first call (this didn't work
before -- the hunks in `_arguments' should fix it) and adding a
specification for the `-i' option on the second call.
For a simple thing such as this, this trick works. If we find an
example where it doesn't work, we'll probably have to allow option
descriptions to say that `everything up to this option is to be
removed from the option string from the line', so that the next call
to `_arguments' sees only those options it knows of. Or maybe we can
find a better solution.
Bye
Sven
diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments Wed Sep 8 09:03:47 1999
+++ Completion/Base/_arguments Wed Sep 8 13:24:25 1999
@@ -6,7 +6,7 @@
setopt localoptions extendedglob
local args rest ws cur nth def nm expl descr action opt arg tmp xor
-local single uns ret=1 soptseq soptseq1 sopts prefix _line odescr
+local single uns ret=1 aret soptseq soptseq1 sopts prefix _line odescr
local beg optbeg argbeg nargbeg inopt inrest fromrest cmd="$words[1]"
local matched curopt
@@ -488,7 +488,7 @@
fi
if [[ "$def" = [^*]*[^\\]:*[^\\]:* ]]; then
def="${def#?*[^\\]:*[^\\]:}"
- else
+ elif [[ "$def" != \** ]]; then
def=''
fi
fi
@@ -548,7 +548,7 @@
def="${def#?*[^\\]:*[^\\]:}"
optbeg="$beg"
argbeg="$beg"
- else
+ elif [[ "$def" != \** ]]; then
def=''
fi
fi
@@ -560,12 +560,16 @@
if [[ -n "$uns" ]]; then
uns="${(@j::)${(v)=xors[(I)${ws[1][1]}[$uns]]}#[-+]}"
- tmp=(
- "opts[${(@)^opts[(I)${ws[1][1]}[$uns]]}]"
- "dopts[${(@)^dopts[(I)${ws[1][1]}[$uns]]}]"
- "odopts[${(@)^odopts[(I)${ws[1][1]}[$uns]]}]"
- )
- (( $#tmp )) && unset "$tmp[@]"
+ if [[ -n "$uns" ]]; then
+ tmp=(
+ "opts[${(@)^opts[(I)${ws[1][1]}[$uns]]}]"
+ "dopts[${(@)^dopts[(I)${ws[1][1]}[$uns]]}]"
+ "odopts[${(@)^odopts[(I)${ws[1][1]}[$uns]]}]"
+ "xors[${(@)^xors[(I)${ws[1][1]}[$uns]]}]"
+ )
+ odescr=( "${(@)odescr:#${ws[1][1]}[$uns]:*}" )
+ (( $#tmp )) && unset "$tmp[@]"
+ fi
fi
# If we didn't find a matching option description and we were
@@ -672,12 +676,16 @@
if [[ -n "$uns" ]]; then
uns="${(@j::)${(v)=xors[(I)${ws[1][1]}[$uns]]}#[-+]}"
- tmp=(
- "opts[${(@)^opts[(I)${pre[1]}[$uns]]}]"
- "dopts[${(@)^dopts[(I)${pre[1]}[$uns]]}]"
- "odopts[${(@)^odopts[(I)${pre[1]}[$uns](|=)]}]"
- )
- (( $#tmp )) && unset "$tmp[@]"
+ if [[ -n "$uns" ]]; then
+ tmp=(
+ "opts[${(@)^opts[(I)${pre[1]}[$uns]]}]"
+ "dopts[${(@)^dopts[(I)${pre[1]}[$uns]]}]"
+ "odopts[${(@)^odopts[(I)${pre[1]}[$uns](|=)]}]"
+ "xors[${(@)^xors[(I)${pre[1]}[$uns]]}]"
+ )
+ odescr=( "${(@)odescr:#${pre[1]}[$uns]:*}" )
+ (( $#tmp )) && unset "$tmp[@]"
+ fi
fi
# If we aren't in an argument directly after a option name, all option
@@ -740,7 +748,7 @@
options=( "${(@kv)_options}" )
state="${${action[3,-1]##[ ]#}%%[ ]#}"
compstate[restore]=''
- return 300
+ aret=yes
else
if [[ "${(t)line}" != *local* ]]; then
local line
@@ -799,7 +807,7 @@
# Probably add the option names.
if [[ -n "$opt" &&
- ( nm -eq compstate[nmatches] ||
+ ( ( nm -eq compstate[nmatches] && -z "$aret" ) ||
-z "$compconfig[option_prefix]" ||
"$compconfig[option_prefix]" = *\!${cmd}* ||
"$PREFIX" = [-+]* ) ]]; then
@@ -881,6 +889,8 @@
break
done
+
+[[ -n "$aret" ]] && return 300
# Set the return value.
diff -u -r oldcompletion/Linux/_rpm Completion/Linux/_rpm
--- oldcompletion/Linux/_rpm Wed Sep 8 09:03:54 1999
+++ Completion/Linux/_rpm Wed Sep 8 13:24:33 1999
@@ -50,21 +50,26 @@
# Do simple completions or get the first state.
-_arguments \
+_arguments -s \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
'-q:*:query:->query' \
- -{V,v,vv,y,-{setperms,setugids,querytags,initdb,showrc}} \
- '-pipe:*:pipe command:_command_names -e' \
+ '*-v' \
+ -{V,y,-{setperms,setugids,querytags,initdb,showrc}} \
+ '-pipe:pipe command:_command_names -e' \
'--verify:*:verify:->verify' \
- -{i,-install}':*:install:->install' \
- -{U,-upgrade}':*:upgrade:->upgrade' \
- -{e,-erase}':*:uninstall:->uninstall' \
+ '-i+:*:install:->install' \
+ '--install:*:install:->install' \
+ '-U+:*:upgrade:->upgrade' \
+ '--upgrade:*:upgrade:->upgrade' \
+ '-e+:*:uninstall:->uninstall' \
+ '--erase:*:uninstall:->uninstall' \
-'b+:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_b' \
-'t+:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_t' \
--{rebuild,rmsource,recompile,resign,addsign}':*:RPM package:->package' \
- -{K,-checksig}':*:sigcheck:->sigcheck' \
+ '-K+:*:sigcheck:->sigcheck' \
+ '--checksig:*:sigcheck:->sigcheck' \
'--rebuilddb:*:rebuild:->rebuild' && ret=0
# As long as we have a state name...
@@ -85,8 +90,8 @@
case "$lstate" in
query)
- _arguments \
- -{v,vv} \
+ _arguments -s \
+ '*-v' \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
@@ -101,8 +106,8 @@
'*:RPM package:->package_or_file' && ret=0
;;
verify)
- _arguments \
- -{v,vv} \
+ _arguments -s \
+ '*-v' \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
@@ -112,11 +117,13 @@
'*:RPM package:->package' && ret=0
;;
upgrade)
- tmp=( --oldpackage )
+ tmp=( -U --oldpackage )
;&
install)
- _arguments "$tmp[@]" \
- -{v,vv} \
+ (( $#tmp )) || tmp=(-i)
+#set -x
+ _arguments -s "$tmp[@]" \
+ '*-v' \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
@@ -128,8 +135,8 @@
'*:pkg file:->package_file' && ret=0
;;
uninstall)
- _arguments \
- -{v,vv} \
+ _arguments -s \
+ '*-v' -e \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
@@ -144,8 +151,8 @@
build_t)
(( $#tmp )) || tmp=( '*:tar file:_files -g \*.\(\#i\)tar\(.\*\|\)' )
- _arguments \
- -{v,vv} \
+ _arguments -s \
+ '*-v' \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
@@ -156,8 +163,8 @@
'--timecheck:time check (seconds):' "$tmp[1]" && ret=0
;;
sigcheck)
- _arguments \
- -{v,vv} \
+ _arguments -s \
+ '*-v' -K \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
@@ -165,8 +172,8 @@
'*:RPM package file:->package_or_file' && ret=0
;;
rebuild)
- _arguments \
- -{v,vv} \
+ _arguments -s \
+ '*-v' \
'--rcfile:resource file:_files' \
'--ftpproxy:FTP proxy server:_hosts' \
'--ftpport:FTP port number:' \
@@ -185,7 +192,8 @@
if compset -P ftp:; then
_hosts -S/ && ret=0
else
- _files -g '*.(#i)rpm' && ret=0
+ _description expl 'RPM package file'
+ _files "$expl[@]" -g '*.(#i)rpm' && ret=0
fi
;;
tags)
diff -u od/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- od/Zsh/compsys.yo Tue Sep 7 14:58:11 1999
+++ Doc/Zsh/compsys.yo Wed Sep 8 11:47:28 1999
@@ -1000,7 +1000,11 @@
word from the line is considered to contain only one option (or
none). By giving the tt(-s) option to this function (as the first
argument), options are considered to be one-character options and the
-strings from the line may contain more than one such option letter.
+strings from the line may contain more than one such option
+letter. However, strings beginning with two hyphens (like
+`tt(-)tt(-prefix)') are still considered to contain only one option
+name. This allows the use of the `tt(-s)' option to describe
+single-letter options together with such long option names.
The function can also be made to automatically complete long options
for commands that support the `tt(-)tt(-help)' option as, for example,
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: _rpm fixes
1999-09-07 9:10 ` Adam Spiers
@ 1999-09-07 16:48 ` Adam Spiers
0 siblings, 0 replies; 7+ messages in thread
From: Adam Spiers @ 1999-09-07 16:48 UTC (permalink / raw)
To: zsh-workers
Adam Spiers, on thelonious (adam@thelonious.new.ox.ac.uk) wrote:
> Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> > I don't know `rpm' very well and the documentation I have is very
> > imprecise, that's why I was asking for help when I first sent the
> > `Rpm/*' functions.
> >
> > Is the rest of the function ok?
>
> I haven't played with it much yet (still discovering the joys of all
> the bells and whistles with the new completion system,
> e.g. description_format with group_matches, which is GREAT!) but I use
> rpm a fair bit so of course I'll fix any more problems I find.
Well, at least, I would if I knew how to...
Next problem: rpm allows single letter switches to be grouped, but
_rpm doesn't recognise this, e.g.
% rpm -ihv <TAB>
doesn't complete .rpm files.
Presumably the -s of _arguments will help here, but how do you use it
without mucking up all the long options? Two separate calls to
_arguments?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: _rpm fixes
1999-09-07 8:20 Sven Wischnowsky
@ 1999-09-07 9:10 ` Adam Spiers
1999-09-07 16:48 ` Adam Spiers
0 siblings, 1 reply; 7+ messages in thread
From: Adam Spiers @ 1999-09-07 9:10 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
>
> Adam Spiers wrote:
>
> > ...
> >
> > I also fixed -b to complete .spec files. It
> > was completing installed rpms before for some reason.
>
> I don't know `rpm' very well and the documentation I have is very
> imprecise, that's why I was asking for help when I first sent the
> `Rpm/*' functions.
>
> Is the rest of the function ok?
I haven't played with it much yet (still discovering the joys of all
the bells and whistles with the new completion system,
e.g. description_format with group_matches, which is GREAT!) but I use
rpm a fair bit so of course I'll fix any more problems I find. At
first glance however it looks fantastic. Pressing tab after `rpm -b'
and getting:
> rpm -b
build stage
a -- build binary and source packages
b -- build a binary package
c -- execute build stage
i -- execute install stage
l -- do a list check
p -- execute %prep stage
blew my mind! gcc, anyone? 8-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: _rpm fixes
@ 1999-09-07 8:20 Sven Wischnowsky
1999-09-07 9:10 ` Adam Spiers
0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 1999-09-07 8:20 UTC (permalink / raw)
To: zsh-workers
Adam Spiers wrote:
> ...
>
> I also fixed -b to complete .spec files. It
> was completing installed rpms before for some reason.
I don't know `rpm' very well and the documentation I have is very
imprecise, that's why I was asking for help when I first sent the
`Rpm/*' functions.
Is the rest of the function ok?
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1999-09-08 11:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-06 11:50 3.1.6-pws-3 Sven Wischnowsky
1999-09-06 18:11 ` _rpm fixes Adam Spiers
1999-09-07 8:20 Sven Wischnowsky
1999-09-07 9:10 ` Adam Spiers
1999-09-07 16:48 ` Adam Spiers
1999-09-08 11:25 Sven Wischnowsky
1999-09-08 11:27 Sven Wischnowsky
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).