ostree: provide command description in a better place
authorRuixin Bao <peter.bao@mail.utoronto.ca>
Tue, 17 Oct 2017 20:42:04 +0000 (20:42 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 20 Oct 2017 12:59:33 +0000 (12:59 +0000)
This is similar idea as
https://github.com/projectatomic/rpm-ostree/pull/916/commits/5c0bf889155573feec108501ce849ac09a0c9567,

The duplicated description is now removed, and the description
of the command is now displayed beneath the Usage.

For example:
ostree cat -h will output the following:

"Usage:
  ostree cat [OPTION?] COMMIT PATH...

Concatenate contents of files"

Closes: #1267
Approved by: cgwalters

48 files changed:
src/ostree/main.c
src/ostree/ot-admin-builtin-cleanup.c
src/ostree/ot-admin-builtin-deploy.c
src/ostree/ot-admin-builtin-diff.c
src/ostree/ot-admin-builtin-init-fs.c
src/ostree/ot-admin-builtin-os-init.c
src/ostree/ot-admin-builtin-status.c
src/ostree/ot-admin-builtin-switch.c
src/ostree/ot-admin-builtin-undeploy.c
src/ostree/ot-admin-builtin-unlock.c
src/ostree/ot-admin-builtin-upgrade.c
src/ostree/ot-admin-instutil-builtin-grub2-generate.c
src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
src/ostree/ot-admin-instutil-builtin-set-kargs.c
src/ostree/ot-builtin-cat.c
src/ostree/ot-builtin-checkout.c
src/ostree/ot-builtin-checksum.c
src/ostree/ot-builtin-commit.c
src/ostree/ot-builtin-config.c
src/ostree/ot-builtin-create-usb.c
src/ostree/ot-builtin-diff.c
src/ostree/ot-builtin-export.c
src/ostree/ot-builtin-find-remotes.c
src/ostree/ot-builtin-fsck.c
src/ostree/ot-builtin-gpg-sign.c
src/ostree/ot-builtin-init.c
src/ostree/ot-builtin-log.c
src/ostree/ot-builtin-ls.c
src/ostree/ot-builtin-prune.c
src/ostree/ot-builtin-pull-local.c
src/ostree/ot-builtin-pull.c
src/ostree/ot-builtin-refs.c
src/ostree/ot-builtin-reset.c
src/ostree/ot-builtin-rev-parse.c
src/ostree/ot-builtin-show.c
src/ostree/ot-builtin-static-delta.c
src/ostree/ot-builtin-summary.c
src/ostree/ot-main.c
src/ostree/ot-remote-builtin-add-cookie.c
src/ostree/ot-remote-builtin-add.c
src/ostree/ot-remote-builtin-delete-cookie.c
src/ostree/ot-remote-builtin-delete.c
src/ostree/ot-remote-builtin-gpg-import.c
src/ostree/ot-remote-builtin-list-cookies.c
src/ostree/ot-remote-builtin-list.c
src/ostree/ot-remote-builtin-refs.c
src/ostree/ot-remote-builtin-show-url.c
src/ostree/ot-remote-builtin-summary.c

index 4ae261d681d7c4c70923ed4acaa34ab47b80e20b..d50c2490c5d6573e0ff08bdd70f834b8762512b6 100644 (file)
@@ -39,7 +39,7 @@ static OstreeCommand commands[] = {
    */
   { "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"},
index bc7a724bde641da489088e50aeb4d430461ea408..996afd2440c4f6632c3e5d6ab528d81a25943e3f 100644 (file)
@@ -44,7 +44,7 @@ ot_admin_builtin_cleanup (int argc, char **argv, OstreeCommandInvocation *invoca
   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,
index 6bfc09ee98456368fa5bd33a79eef07b36653635..ae2879399d437e4b24fb75419888fa8cfd846ed3 100644 (file)
@@ -65,7 +65,7 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
   __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,
index ec8f692e88abd0764fe2dd1239b42f2df07f39dc..fe0c5365d31420d9fec5548c51ae310c9d5f2217 100644 (file)
@@ -54,7 +54,7 @@ ot_admin_builtin_diff (int argc, char **argv, OstreeCommandInvocation *invocatio
   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);
 
index e1c0e4396dde6528c013d9ba43da45530098698a..e2bee8a34d23839f54efe428ff67515b8a41cc06 100644 (file)
@@ -40,7 +40,7 @@ static GOptionEntry options[] = {
 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 |
index a6a11f99e61a6bee343e776a00583308c3930463..92dc54fbaf5a7b9cd03b8834e06fa485debeecb0 100644 (file)
@@ -45,7 +45,7 @@ ot_admin_builtin_os_init (int argc, char **argv, OstreeCommandInvocation *invoca
   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,
index b88c2fbad6f809c32d83c588412429f0a43ab750..b763618c65c671d3026ef70df8f377eb4c054b39 100644 (file)
@@ -100,7 +100,7 @@ ot_admin_builtin_status (int argc, char **argv, OstreeCommandInvocation *invocat
   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,
index 1b1082d5f55edd1cc9d3b593efd476865422b8d0..fded7aa23f87712c6c35079be2c8b9bbe84bd6aa 100644 (file)
@@ -47,7 +47,7 @@ gboolean
 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,
index 3bddd6cb3306c33b3d5a470ad59e6c712e8c8398..57fc8d61e6041a6f8be88d2645ee516a53aaeef3 100644 (file)
@@ -46,7 +46,7 @@ ot_admin_builtin_undeploy (int argc, char **argv, OstreeCommandInvocation *invoc
   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,
index cb3598fddb9d5d868f01947fffc4a872e69ac77d..60b1209b58180ec3bf68a4260f66c1cf7123b1fb 100644 (file)
@@ -51,7 +51,7 @@ ot_admin_builtin_unlock (int argc, char **argv, OstreeCommandInvocation *invocat
   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,
index c0542f3e160cbf874da9df2d3a6bcf66ef0241a2..225811eb9ec46266f6beb97bf70a0745aa4583be 100644 (file)
@@ -56,7 +56,7 @@ static GOptionEntry options[] = {
 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,
index a7eb0d4ff2dc277bdc8c1dfd5268f559d11a9429..df9d804ba30ac0e5794edef7804d030a7e0c90bf 100644 (file)
@@ -45,7 +45,7 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv, OstreeCommandIn
   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,
index ca3fab174f6abdb3d032e933f34191da26ed9f63..3b54671136c1c16bf621a0fd38c116e4cb379bea 100644 (file)
@@ -196,7 +196,7 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, OstreeC
   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,
index 7419581c1db076c9d85be8dd5028e7eb183c3458..c1c418719d48eb35659c7da12da61ff0c0d1d710 100644 (file)
@@ -58,7 +58,7 @@ ot_admin_instutil_builtin_set_kargs (int argc, char **argv, OstreeCommandInvocat
   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,
index 88bd4fdb26ae6ed4b44df47c8a3275cb7e98ec47..ff45c24af2440556866952e4db19846b501d61a4 100644 (file)
@@ -57,7 +57,7 @@ cat_one_file (GFile         *f,
 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;
index 79718c9c6ce25a749fc4b945837f36b19f214f08..ea21aaac9c078d7eac2da299233cf77d1ea1c5b2 100644 (file)
@@ -288,7 +288,7 @@ ostree_builtin_checkout (int argc, char **argv, OstreeCommandInvocation *invocat
   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;
index 24689ac6dbd8f9facd512084187519cfd671bd1f..b2a5c5a6797e818e4f468105df2bea42166ef9e7 100644 (file)
@@ -69,7 +69,7 @@ gboolean
 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;
index 7df1dfe162d8a9dec7f2ba32f2db2115968d864d..a8eb79aa087439e05d0d84c28aa16661da94e817 100644 (file)
@@ -431,7 +431,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
   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;
index 94e36465bcf8680ece3c23488aae93eba507ec85..0fabaefd654cacf82c76ff45f55b043a23065ebc 100644 (file)
@@ -68,7 +68,7 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio
   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;
index fcde36c0ee7e00e7cf1e93a47ea1c9fdc3835bc6..6a540c966ae58b0a0e942ccbc06ddc74791dd914 100644 (file)
@@ -51,7 +51,7 @@ ostree_builtin_create_usb (int            argc,
   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;
index 9cd7141b7d1db5b3371f5ed7c1330b2cec20e5b4..5f5a4dcdc4e68f58c82d99aefeb017dafc1989ad 100644 (file)
@@ -140,7 +140,7 @@ ostree_builtin_diff (int argc, char **argv, OstreeCommandInvocation *invocation,
   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;
index 83656d044646a4dda462bb9c4a0c2fc24e6961f4..ca85301e07ead618c0c3207bc6ad9dd27353a808 100644 (file)
@@ -77,7 +77,7 @@ ostree_builtin_export (int argc, char **argv, OstreeCommandInvocation *invocatio
   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;
index 3cf6c153977d9bb5909a8bb823ba8df75b36f9dc..b15bce8d7601fac71254e7f19493fe57ccbe0db3 100644 (file)
@@ -134,7 +134,7 @@ ostree_builtin_find_remotes (int            argc,
   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))
index 81ac32182de007dde9abe6aa64051dc130bfbeae..116fdc6b38cbd54927119dc1d950d058f3b52372 100644 (file)
@@ -219,7 +219,7 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
   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;
 
index 3eeeeb01912c3b7775f81fb5d3e5593d7243cad3..14a46f8952d893a42619425ef11fadc974d05141 100644 (file)
@@ -210,7 +210,7 @@ ostree_builtin_gpg_sign (int argc, char **argv,OstreeCommandInvocation *invocati
   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;
index c7729e47d9ba12964956485692f3a4d73504e823..b6b7aed0d5bac06c2dc4b224890529699f05ae10 100644 (file)
@@ -52,7 +52,7 @@ ostree_builtin_init (int argc, char **argv,OstreeCommandInvocation *invocation,
   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;
index ee4b37d07ae64fbdd7961377cd07cd7249f9a487..a8644ec683932ecaff2e5e48880a4ca406060661 100644 (file)
@@ -93,7 +93,7 @@ ostree_builtin_log (int           argc,
   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;
index bababaadc6dd519fbca54df16f2b716b721a1e52..150dbc8986a2ddc4acb9bda31fd669112eb0d532 100644 (file)
@@ -249,7 +249,7 @@ ostree_builtin_ls (int argc, char **argv, OstreeCommandInvocation *invocation, G
   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;
index ab3816bc6335f4c53fbda8313c6f661a9332408d..54b18fccada14ee9f8f3b31dfe3e7d37d5a4c536 100644 (file)
@@ -146,7 +146,7 @@ traverse_keep_younger_than (OstreeRepo *repo, const char *checksum,
 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;
index b907b5aa95e8998e8ab52beae6ed296436e811f5..b4a68fb303291aea7b12deaa85e8a9ee36ab556b 100644 (file)
@@ -76,7 +76,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc
   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;
index 719c4d5b1ae29b6604c0091b6a1d5631a22f4abb..827468ff4af9b27544f6f22c4ca2753e98c68b32 100644 (file)
@@ -155,7 +155,7 @@ ostree_builtin_pull (int argc, char **argv, OstreeCommandInvocation *invocation,
   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;
index 68befc74bcc50226ef4929324893d3dcca9ff0bc..3508a5291f6bd435bf2e0b97f3fc8d2b62502c5a 100644 (file)
@@ -268,7 +268,7 @@ ostree_builtin_refs (int argc, char **argv, OstreeCommandInvocation *invocation,
   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;
index f465e0cfbaf27fa9e63b621e05d2456d6e92997c..e9dcf230e66ff24ffbff4c3a17643fc04d68c4ff 100644 (file)
@@ -51,7 +51,7 @@ ostree_builtin_reset (int           argc,
   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;
index cf1da5a627618a30846437f8dba8177cca0eb8a1..8a4ee37298de5611ca7213b4ea600a92c4e8a35b 100644 (file)
@@ -45,7 +45,7 @@ ostree_builtin_rev_parse (int argc, char **argv, OstreeCommandInvocation *invoca
   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;
index 79dfd29e254ebad3f0d81fe7408151c666101453..2eec7f355caf4eae275c82cd88b382830078425e 100644 (file)
@@ -228,7 +228,7 @@ print_if_found (OstreeRepo        *repo,
 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))
index c9b6b456f393417a4d61b02b9a39c81958fef257..d053500a2384ad9fce0e24c986e8283454f6f696 100644 (file)
@@ -126,7 +126,7 @@ static gboolean
 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;
@@ -154,7 +154,7 @@ ot_static_delta_builtin_show (int argc, char **argv, OstreeCommandInvocation *in
   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;
@@ -184,7 +184,7 @@ ot_static_delta_builtin_delete (int argc, char **argv, OstreeCommandInvocation *
   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;
@@ -214,7 +214,7 @@ ot_static_delta_builtin_generate (int argc, char **argv, OstreeCommandInvocation
   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;
 
@@ -365,7 +365,7 @@ ot_static_delta_builtin_apply_offline (int argc, char **argv, OstreeCommandInvoc
   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;
 
index a1d0fe566481eb702522cd1f5478a1ee1221bdc8..c6319f15cbac7e6bdd9cc8f1af2b89d4262c9632 100644 (file)
@@ -87,7 +87,7 @@ ostree_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invocati
   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;
index c63cff7e3edc8b6c9c9e498118ee8af38bb1b095..22166c5472d9ccd000202d9b69152108f4fcf73d 100644 (file)
@@ -302,8 +302,33 @@ ostree_option_context_parse (GOptionContext *context,
                              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. */
 
index 051d0389b9e17e7a734fad4e3536825fc6d4fc5b..f462d887f653e51f3be8bdbf8ca88d49648d3cc1 100644 (file)
@@ -39,7 +39,7 @@ static GOptionEntry option_entries[] = {
 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))
index 080fd5017046a38795a78401d7e728cecf625275..98fa5b9034641ecca588460a14efaa4f66042b23 100644 (file)
@@ -69,7 +69,7 @@ ot_remote_builtin_add (int argc, char **argv, OstreeCommandInvocation *invocatio
   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))
index 726f3ab611e14dac99565961d390143eeb86ddf1..239c12c00569619fb185bc9e4ea39a921e2273c2 100644 (file)
@@ -41,7 +41,7 @@ gboolean
 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))
index 54cba2bfcf2a5781fe6e44ea81983f6c9825fdd5..f2f8a567a1cb3707481f2a7315de4c5bd9cc99bc 100644 (file)
@@ -44,7 +44,7 @@ gboolean
 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))
index eca2fee652e4a3b88743e2672e0cc7990954c8c5..a5e106dc7adff222fcd9f03c91674471a645f5d9 100644 (file)
@@ -105,7 +105,7 @@ ot_remote_builtin_gpg_import (int argc, char **argv, OstreeCommandInvocation *in
   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))
index 7b7ba5d4eeefd9b6ee0f7a49c908874ad7ac5142..9ea3880ace1c318132cd5438a0ebd11f7d13c01a 100644 (file)
@@ -40,7 +40,7 @@ gboolean
 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))
index 589b97bba982e4b97f028073c351a2b7098ad65d..eb5a1baac8989763cb9fff6d0a35206a8f69b4f3 100644 (file)
@@ -43,7 +43,7 @@ ot_remote_builtin_list (int argc, char **argv, OstreeCommandInvocation *invocati
   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))
index 71d5b5d698631bee64c3920dbcef8bc4a7c080fa..ccf89560bee084d6a9b248dcbf3b3d1810e9fc52 100644 (file)
@@ -45,7 +45,7 @@ ot_remote_builtin_refs (int argc, char **argv, OstreeCommandInvocation *invocati
   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))
index 0f3e56f9d542b7e2a9ec451642232cbf52e23cc6..08274c15a5f222514273df87235bee6256a7869a 100644 (file)
@@ -42,7 +42,7 @@ ot_remote_builtin_show_url (int argc, char **argv, OstreeCommandInvocation *invo
   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))
index 8d50158953209ccb137b756b635d5df0826a240e..0c9f7724474b980bb847bfe7e92ede9a4d2c86ac 100644 (file)
@@ -52,7 +52,7 @@ ot_remote_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invoc
   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))