[ostree] ostree admin instutil: make --help work for subcommands
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] ostree admin instutil: make --help work for subcommands
- Date: Thu, 25 Sep 2014 18:30:08 +0000 (UTC)
commit c9018c785ca7296bf78ebabce5e10ef3094eee66
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Wed Sep 24 09:23:56 2014 -0400
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
...admin-instutil-builtin-selinux-ensure-labeled.c | 14 ++++++++++++++
src/ostree/ot-admin-instutil-builtin-set-kargs.c | 14 ++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
index 2ffe098..8bd0c8a 100644
--- a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
+++ b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
@@ -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;
}
diff --git a/src/ostree/ot-admin-instutil-builtin-set-kargs.c
b/src/ostree/ot-admin-instutil-builtin-set-kargs.c
index 5ca4021..6264a04 100644
--- a/src/ostree/ot-admin-instutil-builtin-set-kargs.c
+++ b/src/ostree/ot-admin-instutil-builtin-set-kargs.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]