1
0
Fork 0
forked from murx/murx

Added -v and --version to show the program version. 1.0 today! :)

This commit is contained in:
Johannes Findeisen 2026-11-21 12:16:50 +01:00
commit c2e697b9f7
6 changed files with 45 additions and 20 deletions

View file

@ -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 pkgname=murx
pkgver=0.20261116 pkgver=1.0
pkgrel=0 pkgrel=0
pkgdesc="Small persistent terminal multiplexer" pkgdesc="Small persistent terminal multiplexer"
url="https://codeberg.org/armin/murx" url="https://codeberg.org/armin/murx"
@ -26,10 +26,10 @@ package() {
} }
sha512sums=" sha512sums="
0a297bc9295533c76b9e4b271b0f4472bf6f36caca68a2480bb0a54d435972d5f205ff9cd272c7f9038dfe59e87840f8a342e636d6f31ce8659b13f05da1ef35 murx.c 0a40b60d95effbf69c8a0904c2031260d8398d9a0fc8f91fc45e260d655d240f6ef0cadaf0d1324b420da7031e43ed13325559d0b9026a4fba9a4eef481ecbbe murx.c
ca73b902d64fc9dc52d8d14b6c8ca6b494f4bea3f3602c29fd2909252668e110edff075c881e014e689d7c7d990dee2a4a96208276bae50243ca382adc5ead80 Makefile ebce5c1268253d4dbf1cc1c7d6200c3bad97cba6361d8ff3c5d4563b670565a1a70d83d7bcb2dc0b1ca9fad9ca49d2ff8366b21ac73fb26cb7b46730d0acc425 Makefile
db9fe919bac2b4976efa6d760b1f917ec6fee88a4f2811ea4ac69334f6f24d522569c2cd3c3d087eb43cace659bf4c00f3c4097cc901d769b4e4000342d65c45 murx.1 c79bb8fc5c00b9ed784a3221e33a9a341ad4ce5b9880585409cce8e068a1e8be1ecb77115784cca0247250870069e3d63b23833857e5e9c5ab3e8da4c036eb4f murx.1
e7393bfcbf2a10d7251c0ae5f9fdc18534b7989bb6688fa71d0cd52eaea9db5744413963acdbefc66951d246b3f2db061168507b8bda2c516f992b9ce5ee0f72 README.md c8a4f7661af194b2b5d04edb90b6d4d87838711d59d12039bc8adaf84c724d311301aad0e2e1ced69719b491b910c0bbb01e610b508348cd6c860bd2c3a0723c README.md
2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE
4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS
" "

View file

@ -40,6 +40,16 @@ pkgarch: pkgclean
makepkg makepkg
pkgsums: 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 abuild checksum
updpkgsums updpkgsums

View file

@ -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 pkgname=murx
pkgver=0.20261116 pkgver=1.0
pkgrel=1 pkgrel=1
pkgdesc='Small persistent terminal multiplexer' pkgdesc='Small persistent terminal multiplexer'
arch=('x86_64' 'aarch64') arch=('x86_64' 'aarch64')
@ -8,10 +8,10 @@ url='https://codeberg.org/armin/murx'
license=('Apache-2.0') license=('Apache-2.0')
depends=('glibc') depends=('glibc')
source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS') source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS')
sha256sums=('50f141c6b6c42bdc13cf7018c2723b58e69fe0027e4f8befcd82dab598478852' sha256sums=('dc7eea9afcc33209d52a0a0a9f654444ece16a122127ffae8ac7f19942521908'
'c683ed74c664ebb2a72603297367ed102afdf27e4d6cee47920db8632a8efa91' '4301fe8afe6a6e7cc665d8820ec43047f6af6f3b394a3a3a4f6e52dcf32fdec2'
'd2219b9be02a6d588c593eb001c2c7f1ada845c4c72fa5837937d08192572678' '9788331168223850709fc3c6cda9c9ab4563ff0ee4e58b992d7c2d24e02bb695'
'624618abc7dbe0154bc304cf97ff414932215455a5d23ee731806b222c74681c' '4f6f36d91e4363f37d9b72b506198658619550a93ec07f122a26d009846e3a7f'
'31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4'
'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb')

View file

@ -18,7 +18,8 @@ make
./murx --clock work # show the status bar clock ./murx --clock work # show the status bar clock
./murx --hostname work # show the hostname: prefix in window titles ./murx --hostname work # show the hostname: prefix in window titles
./murx -l, --list-sessions # list running sessions without attaching ./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. 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 The root directory includes [APKBUILD](APKBUILD) for Alpine Linux and
[PKGBUILD](PKGBUILD) for Arch Linux. Both build the local source files rather [PKGBUILD](PKGBUILD) for Arch Linux. Both build the local source files rather
than downloading a release. Version `0.20261116` identifies an unreleased than downloading a release. The package version comes from `MURX_VERSION` in
snapshot; update the version and release fields when packaging a newer snapshot. `murx.c`. Adjust the package release fields separately as needed.
Both recipes build with the default C compiler, so plain `make` works there too. 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. 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 This builds the package and installs it through pacman. The recipe lists
`x86_64` and `aarch64`; builds run on the current architecture. `x86_64` and `aarch64`; builds run on the current architecture.
After changing any packaged source file (`murx.c`, `Makefile`, `murx.1`, After changing a packaged source file, run `make pkgsums` to sync both package
`README.md`, `LICENSE` or `AUTHORS`), refresh recipe checksums with `abuild checksum` versions and refresh both sets of checksums. This target requires `abuild`
on Alpine and `updpkgsums` (from `pacman-contrib`) on Arch. Neither recipe and `updpkgsums` (from `pacman-contrib`). Neither recipe
requires a test suite; its check step runs `murx --help` as a smoke check. requires a test suite; its check step runs `murx --help` as a smoke check.
## Authors ## Authors

8
murx.1
View file

@ -17,6 +17,9 @@ murx \- small persistent terminal multiplexer
.BR \-h " | " \-\-help .BR \-h " | " \-\-help
.br .br
.B murx .B murx
.BR \-v " | " \-\-version
.br
.B murx
.BR \-l " | " \-\-list\-sessions .BR \-l " | " \-\-list\-sessions
.SH DESCRIPTION .SH DESCRIPTION
.B murx .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. Show the hostname: prefix in window names and the outer terminal title.
.TP .TP
.BR \-h ", " \-\-help .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 .PP
These four display features are disabled by default. Their options apply only These four display features are disabled by default. Their options apply only
when creating a session; they do not change a running server. when creating a session; they do not change a running server.

10
murx.c
View file

@ -33,7 +33,8 @@
* One binary, no config file. Shortcuts and the interface palette have built-in defaults. * 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 [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). * Pure C99 + POSIX (macOS / Linux / FreeBSD / OpenBSD).
*/ */
@ -85,6 +86,7 @@
#define MURX_NOIPA #define MURX_NOIPA
#endif #endif
#define MURX_VERSION "1.0"
#define DEFAULT_PREFIX 0x01 #define DEFAULT_PREFIX 0x01
/* client -> server */ /* 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) { static void print_help(FILE *out) {
fprintf(out, fprintf(out,
"murx " MURX_VERSION "\n\n"
"usage: murx [-p letter] [-s top|bottom] [-c RRGGBB] [--cwd] [--clock] [--murx] [--hostname] [session]\n" "usage: murx [-p letter] [-s top|bottom] [-c RRGGBB] [--cwd] [--clock] [--murx] [--hostname] [session]\n"
" murx -l | --list-sessions\n" " murx -l | --list-sessions\n"
" murx -h | --help\n" " murx -h | --help\n"
" murx -v | --version\n"
"\n" "\n"
"Attach to a running session, or start it if it is not running.\n" "Attach to a running session, or start it if it is not running.\n"
"The session name defaults to \"0\".\n" "The session name defaults to \"0\".\n"
@ -4458,6 +4462,10 @@ int main(int argc, char **argv) {
print_help(stdout); print_help(stdout);
return 0; 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) { if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) {
list = 1; list = 1;
} else if (strcmp(option, "--cwd") == 0) { } else if (strcmp(option, "--cwd") == 0) {