From ca47e7f8e3dd4f4f7de9e4b7b7d16df8f155aeb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 30 Nov 2023 14:18:36 +0100 Subject: [PATCH] extension-tool: Show "version-name" field if set Now that both the website and the Extension app support the custom "version-name" field, we should expose it in the CLI tool as well. As a more developer-oriented tool, keep showing the automatic version along-side the new field when both are set. Part-of: --- subprojects/extensions-tool/src/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/subprojects/extensions-tool/src/main.c b/subprojects/extensions-tool/src/main.c index 5bf2579b7..327617415 100644 --- a/subprojects/extensions-tool/src/main.c +++ b/subprojects/extensions-tool/src/main.c @@ -229,8 +229,9 @@ void print_extension_info (GVariantDict *info, DisplayFormat format) { - const char *uuid, *name, *desc, *path, *url, *author; + const char *uuid, *name, *desc, *path, *url, *author, *version_name; double state, version; + gboolean has_version, has_version_name; g_variant_dict_lookup (info, "uuid", "&s", &uuid); g_print ("%s\n", uuid); @@ -253,7 +254,14 @@ print_extension_info (GVariantDict *info, if (g_variant_dict_lookup (info, "original-author", "&s", &author)) g_print (" %s: %s\n", _("Original author"), author); - if (g_variant_dict_lookup (info, "version", "d", &version)) + has_version = g_variant_dict_lookup (info, "version", "d", &version); + has_version_name = g_variant_dict_lookup (info, "version-name", "&s", &version_name); + + if (has_version_name && has_version) + g_print (" %s: %s (%.0f)\n", _("Version"), version_name, version); + else if (has_version_name) + g_print (" %s: %s\n", _("Version"), version_name); + else if (has_version) g_print (" %s: %.0f\n", _("Version"), version); g_variant_dict_lookup (info, "state", "d", &state);