From: Michael Tremer Date: Tue, 1 Jul 2025 16:13:58 +0000 (+0000) Subject: cli: table: Add option to print Yes/No X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f052dde585802d706ad04e9602d7243267afb0b;p=pakfire.git cli: table: Add option to print Yes/No Signed-off-by: Michael Tremer --- diff --git a/src/cli/lib/table.c b/src/cli/lib/table.c index b21ac834..5236c295 100644 --- a/src/cli/lib/table.c +++ b/src/cli/lib/table.c @@ -195,6 +195,13 @@ int cli_table_add_row(cli_table* self, ...) { case CLI_TABLE_FLOAT: r = pakfire_string_format(buffer, "%f", va_arg(args, double)); break; + + case CLI_TABLE_YESNO: + if (va_arg(args, int)) + r = pakfire_string_format(buffer, "%s", "Yes"); + else + r = pakfire_string_format(buffer, "%s", "No"); + break; } // Break if we could not format the argument diff --git a/src/cli/lib/table.h b/src/cli/lib/table.h index bda3d417..c75f9f7e 100644 --- a/src/cli/lib/table.h +++ b/src/cli/lib/table.h @@ -33,6 +33,7 @@ typedef enum { CLI_TABLE_STRING, CLI_TABLE_INTEGER, CLI_TABLE_FLOAT, + CLI_TABLE_YESNO, } cli_table_col_type; typedef enum {