Open woky opened 3 months ago
This might be helpful: https://github.com/kellyjonbrazil/jc also as extra/jc
in pacman repository.
You can currently use jc --kv
or jc --rpm-qi
each with their own drawbacks. See https://github.com/kellyjonbrazil/jc/issues/570 for pacman support request.
Example I use this myself to list my installed packages by the packager "Unknown Packager":
yay -Qi | jc --pkg-index-deb | jq '.[] | select((.packager == "Unknown Packager") and (.name | contains("debug") | not)) | .name '
Is your feature request related to a problem? Please describe.
I want to an write utility to open package AUR URL in the browser. To get package URL I can parse
yay -Si
output, e.g.It'd be nice to get structured data out of
yay -Si
in JSON format with e.g.--json
flag, so that I can parse required fields with jq:Describe the solution you'd like
I'd like to have
--json
flag which outputs package information as JSON. The JSON structure could be flat dictionary translated from a package'sdesc
file, extended with AUR specific keys for AUR packages.It appears that the format of
desc
files is essentially a dictionary where values are lists of strings:The
--json
flag should transform this by stripping%
from keys for easier selection in jq filters and by creating a list or string values depending on the meaning of the field to produce dictionary such as this:Format for AUR packages can use the same keys where appropriate. AUR specific keys should have
AUR
prefix.Additional metadata should be added with
_
prefix. E.g. to add origin repository to the output, with_REPOSITORY
or_ORIGIN
key:Describe alternatives you've considered
Parsing the current format with
sed
,awk
, et al.