diff options
author | Richard Hughes <richard@hughsie.com> | 2014-06-13 15:19:44 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-06-13 15:19:44 +0100 |
commit | 9a2c7a5fec10847b57ba598bc6ca4db4a14f3928 (patch) | |
tree | eff54a03352e47c4ad75d54787330e38b7ab2790 | |
parent | 383d8b04164c878cdc3cddd465de13eff976618e (diff) | |
download | appstream-glib-9a2c7a5fec10847b57ba598bc6ca4db4a14f3928.tar.gz |
Add a hidden command 'list-commands' for bash-completion
-rw-r--r-- | client/as-util.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/client/as-util.c b/client/as-util.c index 7ab36bd..19e9ff2 100644 --- a/client/as-util.c +++ b/client/as-util.c @@ -166,6 +166,18 @@ as_util_run (AsUtilPrivate *priv, const gchar *command, gchar **values, GError * guint i; _cleanup_string_free_ GString *string = NULL; + /* for bash completion */ + if (g_strcmp0 (command, "list-commands") == 0) { + string = g_string_new (""); + for (i = 0; i < priv->cmd_array->len; i++) { + item = g_ptr_array_index (priv->cmd_array, i); + g_string_append_printf (string, "%s ", item->name); + } + g_string_truncate (string, string->len - 1); + g_print ("%s\n", string->str); + return TRUE; + } + /* find command */ for (i = 0; i < priv->cmd_array->len; i++) { item = g_ptr_array_index (priv->cmd_array, i); |