diff options
author | Richard Hughes <richard@hughsie.com> | 2016-08-17 13:39:30 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-08-17 17:40:35 +0100 |
commit | e35d8320711a2e9f0de5f042d95527823a814191 (patch) | |
tree | 4f83ccd009b8006f59ff4e5bfc1eacba93aff4d3 /client | |
parent | 1feb3abbe56661d83ee798d9ad98e49cfd525267 (diff) | |
download | appstream-glib-e35d8320711a2e9f0de5f042d95527823a814191.tar.gz |
trivial: Add some more search debugging when run with --verbose
Diffstat (limited to 'client')
-rw-r--r-- | client/as-util.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/client/as-util.c b/client/as-util.c index ff7e9b1..f3af154 100644 --- a/client/as-util.c +++ b/client/as-util.c @@ -44,6 +44,7 @@ typedef struct { GOptionContext *context; GPtrArray *cmd_array; gboolean nonet; + gboolean verbose; AsProfile *profile; } AsUtilPrivate; @@ -1256,6 +1257,26 @@ as_util_search (AsUtilPrivate *priv, gchar **values, GError **error) as_app_get_metadata_item (app, "SortKey"), as_app_get_unique_id (app)); } + + /* dump XML */ + if (priv->verbose) { + g_autoptr(GString) xml = NULL; + g_autoptr(AsStore) store_results = as_store_new (); + as_store_set_add_flags (store_results, + AS_STORE_ADD_FLAG_USE_UNIQUE_ID); + for (i = 0; i < array->len; i++) { + app = g_ptr_array_index (array, i); + as_app_remove_metadata (app, "SortKey"); + as_store_add_app (store_results, app); + } + xml = as_store_to_xml (store_results, + AS_NODE_TO_XML_FLAG_ADD_HEADER | + AS_NODE_TO_XML_FLAG_FORMAT_INDENT | + AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE | + AS_NODE_TO_XML_FLAG_SORT_CHILDREN); + g_print ("%s\n", xml->str); + } + return TRUE; } @@ -4127,6 +4148,7 @@ main (int argc, char *argv[]) /* set verbose? */ if (verbose) { + priv->verbose = TRUE; g_setenv ("G_MESSAGES_DEBUG", "all", FALSE); } else { g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, |