bin: Hide admin instutil command

Add a "hidden command" flag, and use it for `admin instutil` since
I regret adding it, and people should be using the API.

Prep for adding another hidden command as part of staging deployments.

(Down the line we should investigate deduplicating the recursive
 command parsing code)

Closes: #1535
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-04-07 11:40:53 -04:00 committed by Atomic Bot
parent 5215f24e68
commit 9d1dacfcc8
6 changed files with 30 additions and 17 deletions

View File

@ -55,9 +55,12 @@ ostree_admin_instutil_option_context_new_with_commands (void)
while (command->name != NULL)
{
g_string_append_printf (summary, "\n %-24s", command->name);
if (command->description != NULL)
g_string_append_printf (summary, "%s", command->description);
if ((command->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
{
g_string_append_printf (summary, "\n %-24s", command->name);
if (command->description != NULL)
g_string_append_printf (summary, "%s", command->description);
}
command++;
}

View File

@ -45,9 +45,9 @@ static OstreeCommand admin_subcommands[] = {
{ "init-fs", OSTREE_BUILTIN_FLAG_NO_REPO,
ot_admin_builtin_init_fs,
"Initialize a root filesystem" },
{ "instutil", OSTREE_BUILTIN_FLAG_NO_REPO,
{ "instutil", OSTREE_BUILTIN_FLAG_NO_REPO | OSTREE_BUILTIN_FLAG_HIDDEN,
ot_admin_builtin_instutil,
"Provide instutil commands, allow admin to change boot configuration and relabel selinux " },
"Deprecated commands intended for installer programs" },
{ "os-init", OSTREE_BUILTIN_FLAG_NO_REPO,
ot_admin_builtin_os_init,
"Initialize empty state for given operating system" },
@ -85,9 +85,12 @@ ostree_admin_option_context_new_with_commands (void)
while (command->name != NULL)
{
g_string_append_printf (summary, "\n %-19s", command->name);
if (command->description != NULL)
g_string_append_printf (summary, "%s", command->description);
if ((command->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
{
g_string_append_printf (summary, "\n %-19s", command->name);
if (command->description != NULL)
g_string_append_printf (summary, "%s", command->description);
}
command++;
}

View File

@ -73,10 +73,12 @@ remote_option_context_new_with_commands (void)
while (subcommand->name != NULL)
{
g_string_append_printf (summary, "\n %-18s", subcommand->name);
if (subcommand->description != NULL)
g_string_append_printf (summary, "%s", subcommand->description);
if ((subcommand->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
{
g_string_append_printf (summary, "\n %-18s", subcommand->name);
if (subcommand->description != NULL)
g_string_append_printf (summary, "%s", subcommand->description);
}
subcommand++;
}

View File

@ -117,7 +117,8 @@ static_delta_usage (char **argv,
while (command->name)
{
print_func (" %-17s%s\n", command->name, command->description ?: "");
if ((command->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
print_func (" %-17s%s\n", command->name, command->description ?: "");
command++;
}

View File

@ -66,10 +66,13 @@ ostree_option_context_new_with_commands (OstreeCommand *commands)
while (commands->name != NULL)
{
g_string_append_printf (summary, "\n %-18s", commands->name);
if ((commands->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
{
g_string_append_printf (summary, "\n %-18s", commands->name);
if (commands->description != NULL )
g_string_append_printf (summary, "%s", commands->description);
if (commands->description != NULL )
g_string_append_printf (summary, "%s", commands->description);
}
commands++;
}

View File

@ -29,7 +29,8 @@
typedef enum {
OSTREE_BUILTIN_FLAG_NONE = 0,
OSTREE_BUILTIN_FLAG_NO_REPO = 1 << 0,
OSTREE_BUILTIN_FLAG_NO_CHECK = 1 << 1
OSTREE_BUILTIN_FLAG_NO_CHECK = 1 << 1,
OSTREE_BUILTIN_FLAG_HIDDEN = 1 << 2,
} OstreeBuiltinFlags;
typedef enum {