From c2e697b9f773ca5690e57aa31190aed3f52109f5 Mon Sep 17 00:00:00 2001 From: hanez Date: Sat, 21 Nov 2026 12:16:50 +0100 Subject: [PATCH] Added -v and --version to show the program version. 1.0 today! :) --- APKBUILD | 12 ++++++------ Makefile | 10 ++++++++++ PKGBUILD | 12 ++++++------ README.md | 13 +++++++------ murx.1 | 8 +++++++- murx.c | 10 +++++++++- 6 files changed, 45 insertions(+), 20 deletions(-) diff --git a/APKBUILD b/APKBUILD index ef5a230..c7223c4 100644 --- a/APKBUILD +++ b/APKBUILD @@ -1,6 +1,6 @@ -# Local source snapshot; refresh checksums with `abuild checksum` after edits. +# Local source snapshot; refresh version and checksums with `make pkgsums`. pkgname=murx -pkgver=0.20261116 +pkgver=1.0 pkgrel=0 pkgdesc="Small persistent terminal multiplexer" url="https://codeberg.org/armin/murx" @@ -26,10 +26,10 @@ package() { } sha512sums=" -0a297bc9295533c76b9e4b271b0f4472bf6f36caca68a2480bb0a54d435972d5f205ff9cd272c7f9038dfe59e87840f8a342e636d6f31ce8659b13f05da1ef35 murx.c -ca73b902d64fc9dc52d8d14b6c8ca6b494f4bea3f3602c29fd2909252668e110edff075c881e014e689d7c7d990dee2a4a96208276bae50243ca382adc5ead80 Makefile -db9fe919bac2b4976efa6d760b1f917ec6fee88a4f2811ea4ac69334f6f24d522569c2cd3c3d087eb43cace659bf4c00f3c4097cc901d769b4e4000342d65c45 murx.1 -e7393bfcbf2a10d7251c0ae5f9fdc18534b7989bb6688fa71d0cd52eaea9db5744413963acdbefc66951d246b3f2db061168507b8bda2c516f992b9ce5ee0f72 README.md +0a40b60d95effbf69c8a0904c2031260d8398d9a0fc8f91fc45e260d655d240f6ef0cadaf0d1324b420da7031e43ed13325559d0b9026a4fba9a4eef481ecbbe murx.c +ebce5c1268253d4dbf1cc1c7d6200c3bad97cba6361d8ff3c5d4563b670565a1a70d83d7bcb2dc0b1ca9fad9ca49d2ff8366b21ac73fb26cb7b46730d0acc425 Makefile +c79bb8fc5c00b9ed784a3221e33a9a341ad4ce5b9880585409cce8e068a1e8be1ecb77115784cca0247250870069e3d63b23833857e5e9c5ab3e8da4c036eb4f murx.1 +c8a4f7661af194b2b5d04edb90b6d4d87838711d59d12039bc8adaf84c724d311301aad0e2e1ced69719b491b910c0bbb01e610b508348cd6c860bd2c3a0723c README.md 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS " diff --git a/Makefile b/Makefile index 3f28aa6..44ec907 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,16 @@ pkgarch: pkgclean makepkg pkgsums: + @version=$$(sed -n 's/^#define MURX_VERSION "\([^"]*\)"$$/\1/p' murx.c); \ + if [ -z "$$version" ]; then \ + echo "Could not read MURX_VERSION from murx.c" >&2; exit 1; \ + fi; \ + tmp=$$(mktemp .pkgsums.XXXXXX) || exit 1; \ + trap 'rm -f "$$tmp"' 0; \ + for recipe in APKBUILD PKGBUILD; do \ + sed "s/^pkgver=.*/pkgver=$$version/" "$$recipe" > "$$tmp" && \ + cat "$$tmp" > "$$recipe" || exit 1; \ + done abuild checksum updpkgsums diff --git a/PKGBUILD b/PKGBUILD index 1b420ae..1c0115e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ -# Local source snapshot; refresh checksums with `updpkgsums` after edits. +# Local source snapshot; refresh version and checksums with `make pkgsums`. pkgname=murx -pkgver=0.20261116 +pkgver=1.0 pkgrel=1 pkgdesc='Small persistent terminal multiplexer' arch=('x86_64' 'aarch64') @@ -8,10 +8,10 @@ url='https://codeberg.org/armin/murx' license=('Apache-2.0') depends=('glibc') source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS') -sha256sums=('50f141c6b6c42bdc13cf7018c2723b58e69fe0027e4f8befcd82dab598478852' - 'c683ed74c664ebb2a72603297367ed102afdf27e4d6cee47920db8632a8efa91' - 'd2219b9be02a6d588c593eb001c2c7f1ada845c4c72fa5837937d08192572678' - '624618abc7dbe0154bc304cf97ff414932215455a5d23ee731806b222c74681c' +sha256sums=('dc7eea9afcc33209d52a0a0a9f654444ece16a122127ffae8ac7f19942521908' + '4301fe8afe6a6e7cc665d8820ec43047f6af6f3b394a3a3a4f6e52dcf32fdec2' + '9788331168223850709fc3c6cda9c9ab4563ff0ee4e58b992d7c2d24e02bb695' + '4f6f36d91e4363f37d9b72b506198658619550a93ec07f122a26d009846e3a7f' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') diff --git a/README.md b/README.md index 01081d6..a627413 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ make ./murx --clock work # show the status bar clock ./murx --hostname work # show the hostname: prefix in window titles ./murx -l, --list-sessions # list running sessions without attaching -./murx --help # all shortcuts +./murx --help # version, usage and all shortcuts +./murx --version # print the version and exit (also -v) ``` Detach with `Ctrl-A d`. Run `murx` again to reattach. @@ -392,8 +393,8 @@ that otherwise collapses pane grids to 1x1. The root directory includes [APKBUILD](APKBUILD) for Alpine Linux and [PKGBUILD](PKGBUILD) for Arch Linux. Both build the local source files rather -than downloading a release. Version `0.20261116` identifies an unreleased -snapshot; update the version and release fields when packaging a newer snapshot. +than downloading a release. The package version comes from `MURX_VERSION` in +`murx.c`. Adjust the package release fields separately as needed. Both recipes build with the default C compiler, so plain `make` works there too. The packages install under `/usr`, including the manual, README and license. @@ -418,9 +419,9 @@ makepkg -si This builds the package and installs it through pacman. The recipe lists `x86_64` and `aarch64`; builds run on the current architecture. -After changing any packaged source file (`murx.c`, `Makefile`, `murx.1`, -`README.md`, `LICENSE` or `AUTHORS`), refresh recipe checksums with `abuild checksum` -on Alpine and `updpkgsums` (from `pacman-contrib`) on Arch. Neither recipe +After changing a packaged source file, run `make pkgsums` to sync both package +versions and refresh both sets of checksums. This target requires `abuild` +and `updpkgsums` (from `pacman-contrib`). Neither recipe requires a test suite; its check step runs `murx --help` as a smoke check. ## Authors diff --git a/murx.1 b/murx.1 index 7972858..033a25d 100644 --- a/murx.1 +++ b/murx.1 @@ -17,6 +17,9 @@ murx \- small persistent terminal multiplexer .BR \-h " | " \-\-help .br .B murx +.BR \-v " | " \-\-version +.br +.B murx .BR \-l " | " \-\-list\-sessions .SH DESCRIPTION .B murx @@ -79,7 +82,10 @@ is not enabled. The directory takes precedence if both options are supplied. Show the hostname: prefix in window names and the outer terminal title. .TP .BR \-h ", " \-\-help -Print usage and keyboard shortcuts, then exit. +Print the program version, usage and keyboard shortcuts, then exit. +.TP +.BR \-v ", " \-\-version +Print the program version and exit. .PP These four display features are disabled by default. Their options apply only when creating a session; they do not change a running server. diff --git a/murx.c b/murx.c index 72d7fe6..2f66345 100644 --- a/murx.c +++ b/murx.c @@ -33,7 +33,8 @@ * One binary, no config file. Shortcuts and the interface palette have built-in defaults. * * murx [session] attach to session (default "0"), or start it - * murx -h|--help show usage and all Ctrl-A shortcut chains + * murx -h|--help show version, usage and all Ctrl-A shortcut chains + * murx -v|--version show version * * Pure C99 + POSIX (macOS / Linux / FreeBSD / OpenBSD). */ @@ -85,6 +86,7 @@ #define MURX_NOIPA #endif +#define MURX_VERSION "1.0" #define DEFAULT_PREFIX 0x01 /* client -> server */ @@ -4353,9 +4355,11 @@ static int run_client(int fd, const char *name, unsigned char prefix, int status static void print_help(FILE *out) { fprintf(out, + "murx " MURX_VERSION "\n\n" "usage: murx [-p letter] [-s top|bottom] [-c RRGGBB] [--cwd] [--clock] [--murx] [--hostname] [session]\n" " murx -l | --list-sessions\n" " murx -h | --help\n" + " murx -v | --version\n" "\n" "Attach to a running session, or start it if it is not running.\n" "The session name defaults to \"0\".\n" @@ -4458,6 +4462,10 @@ int main(int argc, char **argv) { print_help(stdout); return 0; } + if (strcmp(option, "-v") == 0 || strcmp(option, "--version") == 0) { + puts("murx " MURX_VERSION); + return 0; + } if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) { list = 1; } else if (strcmp(option, "--cwd") == 0) {