mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-14 04:59:00 +03:00
ostree: provide command description in a better place
This is similar idea as
5c0bf88915
,
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
This commit is contained in:
parent
298c151fd8
commit
9166605e5a
@ -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"},
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 |
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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. */
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user