]> git.ipfire.org Git - pakfire.git/commitdiff
cli: Show the repo description when listing repositories master
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Jul 2025 16:54:10 +0000 (16:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Jul 2025 16:54:10 +0000 (16:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/cli/lib/repo_list.c

index 9ea8a3d15f1d7246568b3d64640ab0e47a03c2c5..bc7e0a3b025c31b458fff1267db5ef94a741f566 100644 (file)
@@ -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;
        }