ostree admin instutil: make --help work for subcommands
Even though the subcommands don't take arguments, use a GOptionContext so that --help works as expected. https://bugzilla.gnome.org/show_bug.cgi?id=737194
This commit is contained in:
parent
9d72ff2d8e
commit
c9018c785c
|
|
@ -173,6 +173,10 @@ selinux_relabel_dir (OstreeSePolicy *sepolicy,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
gboolean
|
||||
ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, OstreeSysroot *sysroot, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
|
|
@ -183,8 +187,16 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, OstreeS
|
|||
gs_unref_object OstreeSePolicy *sepolicy = NULL;
|
||||
gs_unref_ptrarray GPtrArray *deployments = NULL;
|
||||
OstreeDeployment *first_deployment;
|
||||
GOptionContext *context = NULL;
|
||||
gs_unref_object GFile *deployment_path = NULL;
|
||||
|
||||
context = g_option_context_new ("[SUBPATH PREFIX] - relabel all or part of a deployment");
|
||||
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
|
||||
if (!g_option_context_parse (context, &argc, &argv, error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_sysroot_load (sysroot, cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
|
@ -227,5 +239,7 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, OstreeS
|
|||
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@
|
|||
|
||||
#include "otutil.h"
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
gboolean
|
||||
ot_admin_instutil_builtin_set_kargs (int argc, char **argv, OstreeSysroot *sysroot, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
|
|
@ -34,8 +38,16 @@ ot_admin_instutil_builtin_set_kargs (int argc, char **argv, OstreeSysroot *sysro
|
|||
guint i;
|
||||
gs_unref_ptrarray GPtrArray *deployments = NULL;
|
||||
OstreeDeployment *first_deployment = NULL;
|
||||
GOptionContext *context = NULL;
|
||||
gs_unref_ptrarray GPtrArray *new_kargs = NULL;
|
||||
|
||||
context = g_option_context_new ("ARGS - set new kernel command line arguments");
|
||||
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
|
||||
if (!g_option_context_parse (context, &argc, &argv, error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_sysroot_load (sysroot, cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
|
@ -60,5 +72,7 @@ ot_admin_instutil_builtin_set_kargs (int argc, char **argv, OstreeSysroot *sysro
|
|||
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue