summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2019-10-17 09:54:27 +0100
committerRichard Hughes <richard@hughsie.com>2019-10-17 09:54:27 +0100
commit2509805feeddeb415ea4954cebdbb0288e8273fe (patch)
treebdbef2304ad50b1679598be1bb780822fd2a2e81
parentd407862968c6528f44c93102e53da5664ffc8f4d (diff)
downloadappstream-glib-2509805feeddeb415ea4954cebdbb0288e8273fe.tar.gz
trivial: Remove a debug-only command that's too low-level for use
-rw-r--r--client/as-util.c73
1 files changed, 0 insertions, 73 deletions
diff --git a/client/as-util.c b/client/as-util.c
index 9700e69..4f7a4cf 100644
--- a/client/as-util.c
+++ b/client/as-util.c
@@ -1513,73 +1513,6 @@ as_util_query_installed (AsUtilPrivate *priv, gchar **values, GError **error)
return TRUE;
}
-static gint
-as_util_search_token_sort_cb (gconstpointer a, gconstpointer b, gpointer user_data)
-{
- guint *cnt_a;
- guint *cnt_b;
- GHashTable *dict = (GHashTable *) user_data;
- cnt_a = g_hash_table_lookup (dict, (const gchar *) a);
- cnt_b = g_hash_table_lookup (dict, (const gchar *) b);
- if (*cnt_a < *cnt_b)
- return 1;
- if (*cnt_a > *cnt_b)
- return -1;
- return 0;
-}
-
-static gboolean
-as_util_show_search_tokens (AsUtilPrivate *priv, gchar **values, GError **error)
-{
- GPtrArray *apps;
- GList *l;
- guint i;
- guint j;
- const gchar *tmp;
- guint *cnt;
- g_autoptr(GHashTable) dict = NULL;
- g_autoptr(AsStore) store = NULL;
- g_autoptr(GList) keys = NULL;
-
- /* load system database */
- store = as_store_new ();
- if (!as_store_load (store,
- AS_STORE_LOAD_FLAG_APP_INFO_SYSTEM |
- AS_STORE_LOAD_FLAG_APP_INFO_USER,
- NULL, error))
- return FALSE;
- dict = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- apps = as_store_get_apps (store);
- for (i = 0; i < apps->len; i++) {
- AsApp *app;
- g_autoptr(GPtrArray) tokens = NULL;
- app = g_ptr_array_index (apps, i);
- tokens = as_app_get_search_tokens (app);
- for (j = 0; j < tokens->len; j++) {
- tmp = g_ptr_array_index (tokens, j);
- cnt = g_hash_table_lookup (dict, tmp);
- if (cnt == NULL) {
- cnt = g_new0 (guint, 1);
- g_hash_table_insert (dict,
- g_strdup (tmp),
- cnt);
- }
- (*cnt)++;
- }
- }
-
- /* display the keywords sorted */
- keys = g_hash_table_get_keys (dict);
- keys = g_list_sort_with_data (keys, as_util_search_token_sort_cb, dict);
- for (l = keys; l != NULL; l = l->next) {
- tmp = l->data;
- cnt = g_hash_table_lookup (dict, tmp);
- g_print ("%s [%u]\n", tmp, *cnt);
- }
-
- return TRUE;
-}
-
static gboolean
as_util_install (AsUtilPrivate *priv, gchar **values, GError **error)
{
@@ -4407,12 +4340,6 @@ main (int argc, char *argv[])
_("Search for AppStream applications by category name"),
as_util_search_category);
as_util_add (priv->cmd_array,
- "show-search-tokens",
- NULL,
- /* TRANSLATORS: command description */
- _("Display application search tokens"),
- as_util_show_search_tokens);
- as_util_add (priv->cmd_array,
"install",
NULL,
/* TRANSLATORS: command description */