* PATCH: Updated _rpm, but a bug with _arguments
@ 2000-05-30 3:19 Bart Schaefer
2000-05-30 5:54 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2000-05-30 3:19 UTC (permalink / raw)
To: zsh-workers
On May 25, 4:02pm, Bart Schaefer wrote:
} Subject: Re: PATCH: Re: _rpm odd behavior
}
} On May 24, 10:29am, Sven Wischnowsky wrote:
} } Subject: PATCH: Re: _rpm odd behavior
} }
} } [The patch] also adds the `-c'. Any other missing options anywhere?
}
} I may take a look at _rpm later if no one else gets there first. But it
} may be tomorrow, so if someone else has time, don't wait for me.
As of the current CVS sources (_arguments revision 1.25) completion for rpm
doesn't work any longer:
zagzig[24] rpm --rc<TAB>
Completing no arguments
(beep)
zagzig[24] rpm --rc<DEL DEL DEL>
zagzig[24] rpm -<TAB>
Completing option
--verify -- verify mode
-F -- freshen mode
-K -- signature check mode
-U -- upgrade mode
-V -- verify mode
-b -- build mode (spec file)
-e -- uninstall mode
-i -- install mode
-q -- query mode
-t -- build mode (tar file)
-v -- verbose mode
-y -- verify mode
--addsign --ftpport --pipe --rebuilddb --setperms
--checksig --ftpproxy --querytags --recompile --setugids
--erase --initdb --rcfile --resign --showrc
--freshen --install --rebuild --rmsource --upgrade
The difference from 3.1.7-pre-4 appears to be that `comparguments -O ...'
at _arguments:187 fails in the latest version; trace output is identical
up to that point.
That means I'm not able to properly test the following patch for _rpm, but
I *think* it's correct. Two things I didn't work out how to accomplish
are noted in comments under the `query' state.
Index: Completion/Linux/_rpm
===================================================================
@@ -39,8 +39,6 @@
# relocate
# complete a `old=new' pair of paths
-local ret=1 tmp expl
-
# Used by `_arguments', made local here.
local curcontext="$curcontext" state lstate line
@@ -48,33 +46,57 @@
state=''
+local ret=1
+local -a tmp expl commonopts packageopts
+commonopts=(
+ '*-v[verbose mode]'
+ '--rcfile:resource file:_files'
+ '--ftpproxy:FTP proxy server:_hosts'
+ '--ftpport:FTP port number:'
+ '--httpproxy:HTTP proxy server:_hosts'
+ '--httpport:HTTP port number:'
+)
+packageopts=(
+ '-a[query all packages]'
+ '-p+[query uninstalled package file]:*:RPM package file:->package_file'
+ '-f[specify file to query owner of]:file:_files'
+ '--triggeredby:RPM package:->package'
+ '--whatprovides:RPM capability:->capability'
+ '--whatrequires:RPM capability:->capability'
+)
+pathopts=(
+ '--root:RPM root directory:_files -/'
+ '--dbpath:RPM database path:_files -/'
+)
+
# Do simple completions or get the first state.
_arguments -C -s \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
+ '--help[print help message]' \
+ '--version[print version number]' \
+ "${commonopts[@]}" \
'-q+[query mode]:*:query:->query' \
- '*-v[verbose mode]' \
- --{setperms,setugids,querytags,initdb,showrc} \
+ --{querytags,initdb,showrc} \
'--pipe:pipe command:_command_names -e' \
-{V,y}'[verify mode]:*:verify:->verify' \
'--verify[verify mode]:*:verify:->verify' \
- '-i+[install mode]:*:install:->install' \
- '--install:*:install:->install' \
- '-U+[upgrade mode]:*:upgrade:->upgrade' \
- '--upgrade:*:upgrade:->upgrade' \
- '-F+[freshen mode]:*:upgrade:->upgrade' \
- '--freshen:*:upgrade:->upgrade' \
- '-e+[uninstall mode]:*:uninstall:->uninstall' \
- '--erase:*:uninstall:->uninstall' \
- -'b+[build mode (spec file)]: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 mode (tar file)]: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' \
+ '--setperms[set file permissions]:*:package:->setattrs' \
+ '--setugids[set file owner/group]:*:package:->setattrs' \
+ '(--install)-i+[install mode]:*:install:->install' \
+ '(-i)--install:*:install:->install' \
+ '(--upgrade)-U+[upgrade mode]:*:upgrade:->upgrade' \
+ '(-U)--upgrade:*:upgrade:->upgrade' \
+ '(--freshen)-F+[freshen mode]:*:upgrade:->upgrade' \
+ '(-F)--freshen:*:upgrade:->upgrade' \
+ '(--erase)-e+[uninstall mode]:*:uninstall:->uninstall' \
+ '(-e)--erase:*:uninstall:->uninstall' \
+ '-b+[build mode (spec file)]: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' \
+ '(-b)-t+[build mode (tar file)]: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' \
--{resign,addsign}':*:RPM package:->package' \
'--rmsource:*:spec file:->spec_file' \
--{rebuild,recompile}':*:Src RPM files:->package_src' \
- '-K+[signature check mode]:*:sigcheck:->sigcheck' \
- '--checksig:*:sigcheck:->sigcheck' \
+ '(--checksig)-K+[signature check mode]:*:sigcheck:->sigcheck' \
+ '(-K)--checksig:*:sigcheck:->sigcheck' \
'--rebuilddb:*:rebuild:->rebuild' && ret=0
# As long as we have a state name...
@@ -96,59 +118,52 @@
case "$lstate" in
query)
_arguments -s \
- '*-v[verbose mode]' -q -c \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
- '--root:RPM root directory:_files -/' \
- '--dbpath:RPM database path:_files -/' \
+ -q "${commonopts[@]}" "${packageopts[@]}" "${pathopts[@]}" \
'--queryformat:RPM query format:->tags' \
- '-f[specify file to query owner of]:file:_files' \
- '-p+[specify uninstalled package file to query]:*:RPM package file:->package_file' \
- '--triggeredby:RPM package:->package' \
- '--whatprovides:RPM capability:->capability' \
- '--whatrequires:RPM capability:->capability' \
+ '-i[display package information]' \
+ '--changelog[display change log]' \
+ '-l[display package file list]' \
+ '-s[show file states]' \
+ '-d[documentation files only]' \
+ '-c[configuration files only]' \
+ '--dump[show all information]' # Requires one of -{l,c,d} ... \
+ --provides \
+ -{R,-requires}'[list dependencies]' \
+ '--scripts[show (un)install scripts]' \
+ '--triggers[show trigger scripts]' # Requires --scripts ... \
'*:RPM package:->package_or_file' && ret=0
;;
+ setattrs)
+ _arguments -s --set{perm,ugids} "${packageopts[@]}" && ret = 0
+ ;;
verify)
_arguments -s \
- '*-v[verbose mode]' '(-y)-V' '(-V)-y' \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
+ '(-y --verify)-V' '(-V --verify)-y' '(-y -V)--verify' \
+ "${commonopts[@]}" "${pathopts[@]}" \
--no{deps,md5,files} \
- '--root:RPM root directory:_files -/' \
- '--dbpath:RPM database path:_files -/' \
'*:RPM package:->package' && ret=0
;;
upgrade)
- tmp=( -U --oldpackage )
+ tmp=( '(--upgrade)-U' '(-U)--upgrade' '(--force)--oldpackage' )
;&
install)
- (( $#tmp )) || tmp=(-i)
+ (( $#tmp )) || tmp=( '(--install)-i' '(-i)--install' )
_arguments -s "$tmp[@]" \
- '*-v[verbose mode]' \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
- '(-h)--hash' '(--hash)-h' \
- '(--replacepkgs --replacefiles --oldpackage)--force' \
- --{badreloc,excludedocs,allfiles,ignorearch,ignoreos,includedocs,justdb,nodeps,noorder,noscripts,notriggers,percent,replacefiles,replacepkgs,test} \
+ "${commonopts[@]}" "${pathopts[@]}" \
+ '--excludepath:exclude files in following path:_files -/' \
'--relocate:relocate:->relocate' \
'--prefix:package prefix directory:_files -/' \
- '--root:RPM root directory:_files -/' \
- '--dbpath:RPM database path:_files -/' \
+ '(-h)--hash' '(--hash)-h' \
+ '(--replacepkgs --replacefiles --oldpackage)--force' \
+ '(--force)--'{replacefiles,replacepkgs} \
+ --{badreloc,excludedocs,allfiles,ignorearch,ignoreos,includedocs,justdb,nodeps,noorder,noscripts,notriggers,percent,test} \
'*:pkg file:->package_file' && ret=0
;;
uninstall)
_arguments -s \
- '*-v[verbose mode]' -e \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
+ '(-e)--erase' '(--erase)-e' \
+ "${commonopts[@]}" "${pathopts[@]}" \
--{allmatches,justdb,nodeps,noorder,noscripts,notriggers} \
- '--root:RPM root directory:_files -/' \
- '--dbpath:RPM database path:_files -/' \
'*:RPM package:->package' && ret=0
;;
build_b)
@@ -158,10 +173,7 @@
(( $#tmp )) || tmp=( '*:tar file:_files -g \*.\(\#i\)tar\(.\*\|\)' )
_arguments -s \
- '*-v[verbose mode]' \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
+ "${commonopts[@]}" "${pathopts[@]}" \
--{short-circuit,clean,rmsource,sign,test} \
'--target:specify a build target:->target'\
'--buildroot:build root directory:_files -/' \
@@ -171,21 +183,14 @@
;;
sigcheck)
_arguments -s \
- '*-v[verbose mode]' -K \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
+ '(-K)--checksig' '(--checksig)-K' \
+ "${commonopts[@]}" \
--no{pgp,md5} \
'*:RPM package file:->package_file' && ret=0
;;
rebuild)
_arguments -s \
- '*-v[verbose mode]' \
- '--rcfile:resource file:_files' \
- '--ftpproxy:FTP proxy server:_hosts' \
- '--ftpport:FTP port number:' \
- '--root:RPM root directory:_files -/' \
- '--dbpath:RPM database path:_files -/' \
+ "${commonopts[@]}" "${pathopts[@]}" \
'*:RPM source package file:->package_file' && ret=0
;;
target)
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: Updated _rpm, but a bug with _arguments
2000-05-30 3:19 PATCH: Updated _rpm, but a bug with _arguments Bart Schaefer
@ 2000-05-30 5:54 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-05-30 5:54 UTC (permalink / raw)
To: zsh-workers
On May 30, 3:19am, Bart Schaefer wrote:
} Subject: PATCH: Updated _rpm, but a bug with _arguments
}
} As of the current CVS sources (_arguments revision 1.25) completion for rpm
} doesn't work any longer:
}
} zagzig[24] rpm --rc<TAB>
} Completing no arguments
} (beep)
It's actually much worse than this; option completion is entirely broken
when there's anything in the current word other than the leading hyphens.
The culprits seem to be the following two hunks of 11624; for example, if
I delete the `&& !line[2]' then completion after two hyphens and an alpha-
numeric starts working again, but one hyphen and an alphanum still fails.
x@ -1434,7 +1436,11 @@
(state.def->type == CAA_RREST ||
state.def->type == CAA_RARGS)) {
state.inrest = 0;
- state.opt = (cur == state.nargbeg + 1);
+ state.opt = (cur == state.nargbeg + 1 &&
+ (!*line ||
+ ((*line == '-' || *line == '+') &&
+ (!line[1] ||
+ (*line == '-' && line[1] == '-' && !line[2])))));
state.optbeg = state.nargbeg;
state.argbeg = cur - 1;
state.argend = argend;
x@ -1510,6 +1516,10 @@
}
} else {
ca_laststate.def = adef;
+ ca_laststate.opt = (!arglast || !*line ||
+ ((*line == '-' || *line == '+') &&
+ (!line[1] ||
+ (*line == '-' && line[1] == '-' && !line[2]))));
ca_laststate.ddef = NULL;
ca_laststate.dopt = NULL;
ca_laststate.optbeg = state.nargbeg;
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-05-30 5:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-30 3:19 PATCH: Updated _rpm, but a bug with _arguments Bart Schaefer
2000-05-30 5:54 ` Bart Schaefer
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).