Make ostree admin --help output more useful

At a minimum, it should list the available subcommands. This is
still not perfect, since there is no way to get at the help output
of the subcommands - getting that right needs more refactoring.

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Matthias Clasen authored and Colin Walters committed 2012-10-22 18:10:56 -04:00
1 parent 5a51bee024
commit a0449ed246
2 files changed
+15 -1

No files matched your search

+14
View File
@@ -63,6 +63,20 @@ ostree_builtin_admin (int argc, char **argv, GFile *repo_path, GError **error)
ot_lobj GFile *ostree_dir = NULL;
context = g_option_context_new ("[OPTIONS] SUBCOMMAND - Run an administrative subcommand");
{
GString *s = g_string_new ("Subcommands:\n");
subcommand = admin_subcommands;
while (subcommand->name)
{
g_string_append_printf (s, " %s\n", subcommand->name);
subcommand++;
}
g_option_context_set_description (context, s->str);
g_string_free (s, TRUE);
}
g_option_context_add_main_entries (context, options, NULL);
/* Skip subcommand options */
g_option_context_set_ignore_unknown_options (context, TRUE);