falconindy / expac

alpm data extraction utility
91 stars 15 forks source link

Add an equivalent of pacman's -Qp option #2

Closed seschwar closed 11 years ago

seschwar commented 13 years ago

Pacman's query operation has a -p or --file option, which instead of querying the DB entry, allows querying package files directly:

$ pacman -Qi expac | awk -F '[[:space:]]*:[[:space:]]*' '/Name/{print $2}'
expac
$ expac -Q %n expac
expac
$ cd /var/cache/pacman/pkg
$ pacman -Qip expac-0.07-1-i686.pkg.tar.xz | awk -F '[[:space:]]*:[[:space:]]*' '/Name/{print $2}'
expac
$ expac -Qp %n expac-0.07-1-i686.pkg.tar.xz
expac: invalid option -- 'p'
falconindy commented 13 years ago

sure, this seems like a reasonable addition.

falconindy commented 13 years ago

Check out 7ec0a2ff1e1df2d8041.

seschwar commented 12 years ago

-p does the correct thing, however -Qp does not produce any output:

$ cd /tmp
$ git clone git://github.com/falconindy/expac.git
Cloning into expac...
remote: Counting objects: 208, done.
remote: Compressing objects: 100% (195/195), done.
remote: Total 208 (delta 126), reused 42 (delta 13)
Receiving objects: 100% (208/208), 30.21 KiB, done.
Resolving deltas: 100% (126/126), done.
$ cd expac
$ make
cc -c -std=c99 -g -pedantic -Wall -Wextra -Werror -DVERSION=\"0.07-2-g4fc5efb\" expac.c
cc -o expac expac.o -lalpm
pod2man --section=1 --center="expac manual" --name="EXPAC" --release="expac 0.07-2-g4fc5efb" README.pod > expac.1
$ cd /var/cache/pacman/pkg
$ /tmp/expac/expac -Q %n expac
expac
$ /tmp/expac/expac -Qp %n expac-0.07-1-i686.pkg.tar.xz
$ /tmp/expac/expac -p %n expac-0.07-1-i686.pkg.tar.xz
expac

Same with --file and any other output formats.

falconindy commented 12 years ago

Hopefully dealt with in 261c9a958100e9a9aeda5d976788199ddbe182a2