summaryrefslogtreecommitdiff
path: root/Completion/Redhat/Command/_rpm
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Redhat/Command/_rpm')
-rw-r--r--Completion/Redhat/Command/_rpm29
1 files changed, 19 insertions, 10 deletions
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index 83922b60c..b2157bd48 100644
--- a/Completion/Redhat/Command/_rpm
+++ b/Completion/Redhat/Command/_rpm
@@ -32,6 +32,8 @@
# complete a RPM package file name
# package_or_file
# the previous two together
+# file_or_package
+# an absolute path to any file (not a package file) or a package
# tags
# complete a tag name
# capability
@@ -66,7 +68,7 @@ _rpm () {
{-g,--group}'[query packages in one of specified groups]'
--fileid --hdrid --pkgid --tid --querybynumber
'--triggeredby'
- '--whatprovides'
+ '--whatprovides:*:provided file:->file_or_package'
'--whatrequires'
)
sopts=${selectopts%\[*}\ --specfile
@@ -122,7 +124,7 @@ _rpm () {
query)
# --dump requires one of -{l,c,d}
# --triggers requires --script
- _arguments -s \
+ _arguments -s -C \
\!{-q,--query} "${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \
"($sopts)--specfile[query specified spec file as if it were a package]" \
'(-i --info)'{-i,--info}'[display package information]' \
@@ -140,10 +142,10 @@ _rpm () {
{--triggers,--triggerscripts}'[show trigger scripts]' && ret=0
;;
setattrs)
- _arguments -s --set{perm,ugids} "${selectopts[@]}" && ret = 0
+ _arguments -s -C --set{perm,ugids} "${selectopts[@]}" && ret=0
;;
verify)
- _arguments -s \!-{y,V} \
+ _arguments -s -C \!-{y,V} \
"${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \
--no{deps,files,scripts,digest,signature,linkto,md5,size,user,group,mtime,mode,rdev} && ret=0
;;
@@ -151,7 +153,7 @@ _rpm () {
tmp=( '(--force)--oldpackage' )
;&
install)
- _arguments -s \!-{i,U} "$tmp[@]" \
+ _arguments -s -C \!-{i,U} "$tmp[@]" \
"${commonopts[@]}" "${pathopts[@]}" \
'--excludepath:file to exclude:_files -/' \
'--relocate:relocate:->relocate' \
@@ -165,7 +167,7 @@ _rpm () {
'*:pkg file:->package_file' && ret=0
;;
uninstall)
- _arguments -s \!-e \
+ _arguments -s -C \!-e \
"${commonopts[@]}" "${pathopts[@]}" \
--{allmatches,justdb,repackage,test} \
--no{deps,scripts,preun,postun,trigger{s,un,postun}} \
@@ -177,7 +179,7 @@ _rpm () {
build_t)
(( $#tmp )) || tmp=( '*:tar file:_files -g "*.(#i)tar(.*|)(-.)"' )
- _arguments -s \
+ _arguments -s -C \
"${commonopts[@]}" "${pathopts[@]}" \
--{short-circuit,clean,nobuild,rmsource,sign,test} \
'--target:specify a build target:->target'\
@@ -187,13 +189,13 @@ _rpm () {
'--timecheck:time check (seconds):' "$tmp[1]" && ret=0
;;
sigcheck)
- _arguments -s \!-K \
+ _arguments -s -C \!-K \
"${commonopts[@]}" \
--no{gpg,pgp,md5,signature,digest} \
'*:package file:->package_file' && ret=0
;;
rebuild)
- _arguments -s \
+ _arguments -s -C \
"${commonopts[@]}" "${pathopts[@]}" \
'*:source package file:->package_file' && ret=0
;;
@@ -246,6 +248,13 @@ _rpm () {
package_or_file)
state=package_file
;;
+ file_or_package)
+ if [[ $PREFIX = /* ]]; then
+ _wanted files expl 'file' _files
+ else
+ state=package
+ fi
+ ;;
package)
if ( [[ ${+_rpms} -eq 0 ]] || _cache_invalid RPMs ) &&
! _retrieve_cache RPMs;
@@ -286,7 +295,7 @@ _rpm () {
;;
capabilities)
_wanted capabilities expl capability compadd \
- ${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{requirename}\\n' 2>/dev/null)"}
+ ${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{requirename}\\n' 2>/dev/null)"} && ret=0
;;
relocate)
if compset -P '*='; then