aboutsummaryrefslogtreecommitdiff
path: root/clients/bokftui.c
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-18 09:56:10 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-18 09:56:10 +0200
commit041b2dd29d30a8ecadca22ef25282cbad672d94e (patch)
tree303cee3bb41813764b131c0a0f4430d4dbca105d /clients/bokftui.c
parent6de6ffa3e52a2bec519c2a052d0f26d01e38f167 (diff)
downloadbokf-041b2dd29d30a8ecadca22ef25282cbad672d94e.tar.gz
bokf-041b2dd29d30a8ecadca22ef25282cbad672d94e.zip
Show tui and server versions in the status line; derive version from gitv0.1.12
- build: VERSION defaults to git describe, deploy passes the tag via --build-arg - bokftui: srv version from meta, right-aligned next to the status line
Diffstat (limited to 'clients/bokftui.c')
-rw-r--r--clients/bokftui.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/clients/bokftui.c b/clients/bokftui.c
index 5daa606..a7bbf7c 100644
--- a/clients/bokftui.c
+++ b/clients/bokftui.c
@@ -134,6 +134,9 @@ static int jbool_val(const char *resp, const char *path, int def)
/* ------------------------------------------------------------------ */
static char g_status[512];
+static char g_server_version[32];
+
+static int disp_width(const char *s);
static void show_error(const char *title, const char *resp);
static int64_t vouchers_new(struct app *a);
@@ -415,6 +418,15 @@ static void frame(const char *title)
if (g_status[0]) {
attron(A_DIM);
mvaddnstr(1, 2, g_status, COLS - 4);
+ char ver[96];
+ if (g_server_version[0])
+ snprintf(ver, sizeof ver, "tui %s srv %s", BOKF_VERSION,
+ g_server_version);
+ else
+ snprintf(ver, sizeof ver, "tui %s", BOKF_VERSION);
+ int x = COLS - 3 - disp_width(ver);
+ if (x > disp_width(g_status) + 6)
+ mvaddstr(1, x, ver);
attroff(A_DIM);
}
}
@@ -956,6 +968,10 @@ static void app_refresh_context(struct app *a)
a->max_attachment_bytes = 10 * 1024 * 1024;
resp = client_rpc(&a->conn, "meta", NULL, 0, NULL);
if (resp && client_ok(resp)) {
+ char *ver = jstr_dup(resp, "result.version");
+ if (ver && *ver)
+ snprintf(g_server_version, sizeof g_server_version, "%s", ver);
+ free(ver);
int64_t v =
jint_val(resp, "result.limits.max_attachment_bytes", 0);
if (v > 0)