From 8db018c5eebd57d82c69a5eb739bbd74147d31aa Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 2 Jul 2025 16:54:10 +0000 Subject: [PATCH] cli: Show the repo description when listing repositories Signed-off-by: Michael Tremer --- src/cli/lib/repo_list.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cli/lib/repo_list.c b/src/cli/lib/repo_list.c index 9ea8a3d1..bc7e0a3b 100644 --- a/src/cli/lib/repo_list.c +++ b/src/cli/lib/repo_list.c @@ -58,6 +58,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) { static int response_callback(struct pakfire_xfer* xfer, const pakfire_xfer_response* response, void* data) { struct cli_local_args* local_args = data; + const char* description = NULL; json_object* repo = NULL; cli_table* table = NULL; const char* name = NULL; @@ -83,6 +84,10 @@ static int response_callback(struct pakfire_xfer* xfer, if (r < 0) goto ERROR; + r = cli_table_add_col(table, "Description", CLI_TABLE_STRING); + if (r < 0) + goto ERROR; + // Loop through all repos for (size_t i = 0; i < json_object_array_length(response->data); i++) { repo = json_object_array_get_idx(response->data, i); @@ -99,8 +104,13 @@ static int response_callback(struct pakfire_xfer* xfer, if (r < 0) goto ERROR; + // Fetch the description + r = pakfire_json_get_string(repo, "description", &description); + if (r < 0) + goto ERROR; + // Add a new row to the table - r = cli_table_add_row(table, name, priority); + r = cli_table_add_row(table, name, priority, description); if (r < 0) goto ERROR; } -- 2.39.5