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 2012-09-30 12:18:50 -04:00 committed by Colin Walters
parent 5a51bee024
commit a0449ed246
2 changed files with 15 additions and 1 deletions

@ -1 +1 @@
Subproject commit c6b949b3ddd1c214db15a31ccdbdff70aa01fa26
Subproject commit 9f0342c586f8084991ccd7b888dba720bc929be8

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);