I have a feeling that most people who use "pkg contents" just pipe it
through grep or less to look for individual actions if they're looking for
something in particular, but I've been frustrated by the need for that, and
the fact that coming up with the right regular expression is a bit of a
pain ("\<path=[^ ]*/ls", for instance).
So I've been dreaming about an option to contents that allows you to filter
by attribute value. So I could say, for instance:
pkg contents -o path,target -a path=\*.desktop openoffice
(a query that I wanted to run in trying to make sense of bug 6719). That
is, it would give me the path and target attributes of any action in the
openoffice package which had a path attribute that matched the (glob)
pattern "*.desktop". A quickly hacked-together solution gives me what I
wanted:
PATH TARGET
opt/openoffice.org3/share/xdg/base.desktop
opt/openoffice.org3/share/xdg/calc.desktop
opt/openoffice.org3/share/xdg/draw.desktop
opt/openoffice.org3/share/xdg/impress.desktop
opt/openoffice.org3/share/xdg/math.desktop
opt/openoffice.org3/share/xdg/printeradmin.desktop
opt/openoffice.org3/share/xdg/qstart.desktop
opt/openoffice.org3/share/xdg/writer.desktop
usr/share/applications/openoffice.org3-base.desktop
../../../opt/openoffice.org3/share/xdg/base.desktop
usr/share/applications/openoffice.org3-calc.desktop
../../../opt/openoffice.org3/share/xdg/calc.desktop
usr/share/applications/openoffice.org3-draw.desktop
../../../opt/openoffice.org3/share/xdg/draw.desktop
usr/share/applications/openoffice.org3-impress.desktop
../../../opt/openoffice.org3/share/xdg/impress.desktop
usr/share/applications/openoffice.org3-math.desktop
../../../opt/openoffice.org3/share/xdg/math.desktop
usr/share/applications/openoffice.org3-printeradmin.desktop
../../../opt/openoffice.org3/share/xdg/printeradmin.desktop
usr/share/applications/openoffice.org3-writer.desktop
../../../opt/openoffice.org3/share/xdg/writer.desktop
Does this strike anyone but me as useful? Confusing? There are plenty of
bikeshed opportunities (I would use -m for "match", but it's already taken
for "manifest-form", but that could, IMHO, move to -M; are multiple
instances of -a ORed or ANDed together; etc.)
There's also the question of whether this functionality should just be in
search, and the conclusion that Brock and I came to was that there are
pluses and minuses to both approaches, but they both seem useful ways of
getting to the same answer, depending on how your brain approaches the
problem. So I thought I'd see what a larger audience had to say, if
anything.
Thanks,
Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss