about summary refs log tree commit diff
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
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
-rw-r--r--README3
-rwxr-xr-xxnews14
-rw-r--r--xtools.12
3 files changed, 19 insertions, 0 deletions
diff --git a/README b/README
index 5e8520c..291c1a4 100644
--- a/README
+++ b/README
@@ -105,6 +105,9 @@ COMMANDS
         – create XBPS template
           -a  append subpkgs to existing pkg
 
+     xnews [pattern]
+        – list news messages for packages by install-date
+
      xnodev
         – list not installed -devel packages for installed packages
 
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
diff --git a/xtools.1 b/xtools.1
index 1b76740..13aedc2 100644
--- a/xtools.1
+++ b/xtools.1
@@ -131,6 +131,8 @@ Op Ar subpkgs ...
 .It Fl a
 append subpkgs to existing pkg
 .El
+.It Nm xnews Op Ar pattern
+.Nd list news messages for packages by install-date
 .It Nm xnodev
 .Nd list not installed -devel packages for installed packages
 .It Nm xoptdiff \