*/
{ "admin", OSTREE_BUILTIN_FLAG_NO_REPO,
ostree_builtin_admin,
- "Commands that needs admin privilege" },
+ "Commands for managing a host system booted with ostree" },
{ "cat", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_cat,
"Concatenate contents of files"},
g_autoptr(OstreeSysroot) sysroot = NULL;
gboolean ret = FALSE;
- context = g_option_context_new ("Delete untagged deployments and repository objects");
+ context = g_option_context_new ("");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
g_autoptr(GOptionContext) context =
- g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment");
+ g_option_context_new ("REFSPEC");
g_autoptr(OstreeSysroot) sysroot = NULL;
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
g_autoptr(GFile) orig_etc_path = NULL;
g_autoptr(GFile) new_etc_path = NULL;
- context = g_option_context_new ("Diff current /etc configuration versus default");
+ context = g_option_context_new ("");
g_option_context_add_main_entries (context, options, NULL);
gboolean
ot_admin_builtin_init_fs (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = g_option_context_new ("PATH - Initialize a root filesystem");
+ g_autoptr(GOptionContext) context = g_option_context_new ("PATH");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER |
gboolean ret = FALSE;
const char *osname = NULL;
- context = g_option_context_new ("OSNAME - Initialize empty state for given operating system");
+ context = g_option_context_new ("OSNAME");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER | OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
const char *red_bold_suffix = is_tty ? "\x1b[22m\x1b[0m" : "";
guint i;
- context = g_option_context_new ("List deployments");
+ context = g_option_context_new ("");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
ot_admin_builtin_switch (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
g_autoptr(GOptionContext) context =
- g_option_context_new ("REF - Construct new tree from REF and deploy it");
+ g_option_context_new ("REF");
g_autoptr(OstreeSysroot) sysroot = NULL;
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
g_autoptr(GPtrArray) current_deployments = NULL;
g_autoptr(OstreeDeployment) target_deployment = NULL;
- context = g_option_context_new ("INDEX - Delete deployment INDEX");
+ context = g_option_context_new ("INDEX");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
OstreeDeployment *booted_deployment = NULL;
OstreeDeploymentUnlockedState target_state;
- context = g_option_context_new ("Make the current deployment mutable (as a hotfix or development)");
+ context = g_option_context_new ("");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
gboolean
ot_admin_builtin_upgrade (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = g_option_context_new ("Construct new tree from current origin and deploy it, if it changed");
+ g_autoptr(GOptionContext) context = g_option_context_new ("");
g_autoptr(OstreeSysroot) sysroot = NULL;
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
g_autoptr(GOptionContext) context = NULL;
g_autoptr(OstreeSysroot) sysroot = NULL;
- context = g_option_context_new ("[BOOTVERSION] - generate GRUB2 configuration from given BLS entries");
+ context = g_option_context_new ("[BOOTVERSION]");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER | OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
g_autoptr(OstreeSysroot) sysroot = NULL;
g_autoptr(GFile) deployment_path = NULL;
- context = g_option_context_new ("[SUBPATH PREFIX] - relabel all or part of a deployment");
+ context = g_option_context_new ("[SUBPATH PREFIX]");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER | OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
g_autoptr(OstreeSysroot) sysroot = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
- context = g_option_context_new ("ARGS - set new kernel command line arguments");
+ context = g_option_context_new ("ARGS");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER | OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
gboolean
ostree_builtin_cat (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = g_option_context_new ("COMMIT PATH... - Concatenate contents of files");
+ g_autoptr(GOptionContext) context = g_option_context_new ("COMMIT PATH...");
g_autoptr(OstreeRepo) repo = NULL;
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
return FALSE;
const char *destination;
g_autofree char *resolved_commit = NULL;
- context = g_option_context_new ("COMMIT [DESTINATION] - Check out a commit into a filesystem tree");
+ context = g_option_context_new ("COMMIT [DESTINATION]");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
ostree_builtin_checksum (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
g_autoptr(GOptionContext) context =
- g_option_context_new ("PATH - Checksum a file or directory");
+ g_option_context_new ("PATH");
if (!ostree_option_context_parse (context, options, &argc, &argv,
invocation, NULL, cancellable, error))
return FALSE;
struct CommitFilterData filter_data = { 0, };
g_autofree char *commit_body = NULL;
- context = g_option_context_new ("[PATH] - Commit a new revision");
+ context = g_option_context_new ("[PATH]");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autofree char *key = NULL;
GKeyFile *config = NULL;
- context = g_option_context_new ("(get KEY|set KEY VALUE) - Change repo configuration settings");
+ context = g_option_context_new ("(get KEY|set KEY VALUE)");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autoptr(OstreeAsyncProgress) progress = NULL;
g_auto(GLnxConsoleRef) console = { 0, };
- context = g_option_context_new ("MOUNT-PATH COLLECTION-ID REF [COLLECTION-ID REF...] - Copy the refs to a USB stick");
+ context = g_option_context_new ("MOUNT-PATH COLLECTION-ID REF [COLLECTION-ID REF...]");
/* Parse options. */
g_autoptr(OstreeRepo) src_repo = NULL;
g_autoptr(GPtrArray) removed = NULL;
g_autoptr(GPtrArray) added = NULL;
- context = g_option_context_new ("REV TARGETDIR - Compare directory TARGETDIR against revision REV");
+ context = g_option_context_new ("REV TARGETDIR");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
OstreeRepoExportArchiveOptions opts = { 0, };
#endif
- context = g_option_context_new ("COMMIT - Stream COMMIT to stdout in tar format");
+ context = g_option_context_new ("COMMIT");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_auto(GLnxConsoleRef) console = { 0, };
g_autoptr(GHashTable) refs_found = NULL; /* set (element-type OstreeCollectionRef) */
- context = g_option_context_new ("COLLECTION-ID REF [COLLECTION-ID REF...] - Find remotes to serve the given refs");
+ context = g_option_context_new ("COLLECTION-ID REF [COLLECTION-ID REF...]");
/* Parse options. */
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
g_autoptr(OstreeRepo) repo = NULL;
gboolean found_corruption = FALSE;
- g_autoptr(GOptionContext) context = g_option_context_new ("- Check the repository for consistency");
+ g_autoptr(GOptionContext) context = g_option_context_new ("");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
return FALSE;
int n_key_ids, ii;
gboolean ret = FALSE;
- context = g_option_context_new ("COMMIT KEY-ID... - Sign a commit");
+ context = g_option_context_new ("COMMIT KEY-ID...");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
gboolean ret = FALSE;
OstreeRepoMode mode;
- context = g_option_context_new ("- Initialize a new empty repository");
+ context = g_option_context_new ("");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autofree char *checksum = NULL;
OstreeDumpFlags flags = OSTREE_DUMP_NONE;
- context = g_option_context_new ("REF - Show log starting at commit or ref");
+ context = g_option_context_new ("REF");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
int i;
g_autoptr(GFile) root = NULL;
- context = g_option_context_new ("COMMIT [PATH...] - List file paths");
+ context = g_option_context_new ("COMMIT [PATH...]");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
gboolean
ostree_builtin_prune (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = g_option_context_new ("- Search for unreachable objects");
+ g_autoptr(GOptionContext) context = g_option_context_new ("");
g_autoptr(OstreeRepo) repo = NULL;
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
return FALSE;
g_autoptr(GPtrArray) refs_to_fetch = NULL;
OstreeRepoPullFlags pullflags = 0;
- context = g_option_context_new ("SRC_REPO [REFS...] - Copy data from SRC_REPO");
+ context = g_option_context_new ("SRC_REPO [REFS...]");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autoptr(OstreeAsyncProgress) progress = NULL;
gulong signal_handler_id = 0;
- context = g_option_context_new ("REMOTE [BRANCH...] - Download data from remote repository");
+ context = g_option_context_new ("REMOTE [BRANCH...]");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autoptr(OstreeRepo) repo = NULL;
int i;
- context = g_option_context_new ("[PREFIX] - List refs");
+ context = g_option_context_new ("[PREFIX]");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autofree char *checksum = NULL;
/* FIXME: Add support for collection–refs. */
- context = g_option_context_new ("REF COMMIT - Reset a REF to a previous COMMIT");
+ context = g_option_context_new ("REF COMMIT");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
int i;
g_autofree char *resolved_rev = NULL;
- context = g_option_context_new ("REV - Output the target of a rev");
+ context = g_option_context_new ("REV");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
gboolean
ostree_builtin_show (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = g_option_context_new ("OBJECT - Output a metadata object");
+ g_autoptr(GOptionContext) context = g_option_context_new ("OBJECT");
g_autoptr(OstreeRepo) repo = NULL;
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
ot_static_delta_builtin_list (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
g_autoptr(OstreeRepo) repo = NULL;
- g_autoptr(GOptionContext) context = g_option_context_new ("- list static delta files");
+ g_autoptr(GOptionContext) context = g_option_context_new ("");
if (!ostree_option_context_parse (context, list_options, &argc, &argv,
invocation, &repo, cancellable, error))
return FALSE;
g_autoptr(OstreeRepo) repo = NULL;
const char *delta_id = NULL;
- context = g_option_context_new ("- Dump information on a delta");
+ context = g_option_context_new ("");
if (!ostree_option_context_parse (context, list_options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autoptr(OstreeRepo) repo = NULL;
const char *delta_id = NULL;
- context = g_option_context_new ("- Remove a delta");
+ context = g_option_context_new ("");
if (!ostree_option_context_parse (context, list_options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autoptr(GOptionContext) context = NULL;
g_autoptr(OstreeRepo) repo = NULL;
- context = g_option_context_new ("[TO] - Generate static delta files");
+ context = g_option_context_new ("[TO]");
if (!ostree_option_context_parse (context, generate_options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autoptr(GOptionContext) context = NULL;
g_autoptr(OstreeRepo) repo = NULL;
- context = g_option_context_new ("- Apply static delta file");
+ context = g_option_context_new ("");
if (!ostree_option_context_parse (context, apply_offline_options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
g_autoptr(OstreeRepo) repo = NULL;
OstreeDumpFlags flags = OSTREE_DUMP_NONE;
- context = g_option_context_new ("Manage summary metadata");
+ context = g_option_context_new ("");
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
return FALSE;
GError **error)
{
g_autoptr(OstreeRepo) repo = NULL;
- /* When invocation is NULL, it usually means an error occurs, do not fetch repo this case */
+ /* When invocation is NULL, do not fetch repo */
const OstreeBuiltinFlags flags = invocation ? invocation->command->flags : OSTREE_BUILTIN_FLAG_NO_REPO;
+
+ if (invocation && invocation->command->description != NULL)
+ {
+ const char *context_summary = g_option_context_get_summary (context);
+
+ /* If the summary is originally empty, we set the description, but
+ * for root commands(command with subcommands), we want to prepend
+ * the description to the existing summary string
+ */
+ if (context_summary == NULL)
+ g_option_context_set_summary (context, invocation->command->description);
+ else
+ {
+ /* TODO: remove this part once we deduplicate the ostree_option_context_new_with_commands
+ * function from other root commands( command with subcommands). Because
+ * we can directly add the summary inside the ostree_option_context_new_with_commands function.
+ */
+ g_autoptr(GString) new_summary_string = g_string_new (context_summary);
+
+ g_string_prepend (new_summary_string, "\n\n");
+ g_string_prepend (new_summary_string, invocation->command->description);
+
+ g_option_context_set_summary (context, new_summary_string->str);
+ }
+ }
/* Entries are listed in --help output in the order added. We add the
* main entries ourselves so that we can add the --repo entry first. */
gboolean
ot_remote_builtin_add_cookie (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = g_option_context_new ("NAME DOMAIN PATH COOKIE_NAME VALUE - Add a cookie to remote");
+ g_autoptr(GOptionContext) context = g_option_context_new ("NAME DOMAIN PATH COOKIE_NAME VALUE");
g_autoptr(OstreeRepo) repo = NULL;
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
g_autoptr(GVariant) options = NULL;
gboolean ret = FALSE;
- context = g_option_context_new ("NAME [metalink=|mirrorlist=]URL [BRANCH...] - Add a remote repository");
+ context = g_option_context_new ("NAME [metalink=|mirrorlist=]URL [BRANCH...]");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, NULL, cancellable, error))
ot_remote_builtin_delete_cookie (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
g_autoptr(OstreeRepo) repo = NULL;
- g_autoptr(GOptionContext) context = g_option_context_new ("NAME DOMAIN PATH COOKIE_NAME- Remove one cookie from remote");
+ g_autoptr(GOptionContext) context = g_option_context_new ("NAME DOMAIN PATH COOKIE_NAME");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
ot_remote_builtin_delete (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
- g_autoptr(GOptionContext) context = g_option_context_new ("NAME - Delete a remote repository");
+ g_autoptr(GOptionContext) context = g_option_context_new ("NAME");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, NULL, cancellable, error))
guint imported = 0;
gboolean ret = FALSE;
- context = g_option_context_new ("NAME [KEY-ID...] - Import GPG keys");
+ context = g_option_context_new ("NAME [KEY-ID...]");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
ot_remote_builtin_list_cookies (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
g_autoptr(OstreeRepo) repo = NULL;
- g_autoptr(GOptionContext) context = g_option_context_new ("NAME - Show remote repository cookies");
+ g_autoptr(GOptionContext) context = g_option_context_new ("NAME");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
guint ii, n_remotes = 0;
gboolean ret = FALSE;
- context = g_option_context_new ("- List remote repository names");
+ context = g_option_context_new ("");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
gboolean ret = FALSE;
g_autoptr(GHashTable) refs = NULL;
- context = g_option_context_new ("NAME - List remote refs");
+ context = g_option_context_new ("NAME");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
g_autofree char *remote_url = NULL;
gboolean ret = FALSE;
- context = g_option_context_new ("NAME - Show remote repository URL");
+ context = g_option_context_new ("NAME");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))
gboolean gpg_verify_summary;
gboolean ret = FALSE;
- context = g_option_context_new ("NAME - Show remote summary");
+ context = g_option_context_new ("NAME");
if (!ostree_option_context_parse (context, option_entries, &argc, &argv,
invocation, &repo, cancellable, error))