about summary refs log tree commit diff
path: root/xnews
diff options
context:
space:
mode:
authorclassabbyamp <void@placeviolette.net>2023-07-28 02:29:06 -0400
committerLeah Neukirchen <leah@vuxu.org>2023-07-31 22:16:41 +0200
commit2ca7afbfc5e003bc9812f32c3129a580706bb7a3 (patch)
treec1c7ffcffbf32d71c1dd68f519ee417b8a3bd7cb /xnews
parent6982e53238234099420b9767abcc9d73254573f8 (diff)
downloadxtools-2ca7afbfc5e003bc9812f32c3129a580706bb7a3.tar.gz
xtools-2ca7afbfc5e003bc9812f32c3129a580706bb7a3.tar.xz
xtools-2ca7afbfc5e003bc9812f32c3129a580706bb7a3.zip
new tool: xnews
employs a mechanism similar to xilog to get packages in installed order,
then gets the install message for each in that order.

can be filtered by a pattern in the same method as xilog.

maybe there's a bit more efficient way to do this than a subshell + loop
+ file i/o, but I don't see it
Diffstat (limited to 'xnews')
-rwxr-xr-xxnews14
1 files changed, 14 insertions, 0 deletions
diff --git a/xnews b/xnews
new file mode 100755
index 0000000..74e2fe8
--- /dev/null
+++ b/xnews
@@ -0,0 +1,14 @@
+#!/bin/sh
+# xnews [PATTERN] - list news messages for recently installed packages
+#
+if type less >/dev/null; then
+	: "${PAGER:=less}"
+else
+	: "${PAGER:=cat}"
+fi
+
+for pkg in $(xbps-query -p install-date -s '' |
+	sort -t: -k2 -r | cut -d: -f1 | grep -e "${1:-.}"); do
+	xbps-query -p install-msg "$pkg" |
+		awk -v pkg="$pkg" 'NR == 1 { print pkg ":" } { print "  " $0 }'
+done | $PAGER