diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2014-11-14 14:00:13 -0500 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2014-11-24 19:36:07 -0500 |
commit | 97558276e4f855442337be01abc8f90cf0dd1810 (patch) | |
tree | cadf8676b5163ed41c810335a57ddd4cf0e95f26 /src/ostree/ot-main.h | |
parent | 3a9127f103df3f4574aa441e044447cf36358578 (diff) | |
download | ostree-97558276e4f855442337be01abc8f90cf0dd1810.tar.gz |
Refactor command-line parsing
Refactor command-line parsing to better utilize GOptionContext. This
eliminates most of the manual parsing and global options are now shown
in the help output.
Here's a sample:
$ ostree admin --help
Usage:
ostree admin [OPTION...] --print-current-dir|COMMAND
Builtin "admin" Commands:
cleanup
config-diff
deploy
init-fs
instutil
os-init
status
switch
undeploy
upgrade
Help Options:
-h, --help Show help options
Application Options:
--sysroot=PATH Create a new OSTree sysroot at PATH
-v, --verbose Print debug information during command processing
--version Print version information and exit
https://bugzilla.gnome.org/show_bug.cgi?id=740295
Diffstat (limited to 'src/ostree/ot-main.h')
-rw-r--r-- | src/ostree/ot-main.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ostree/ot-main.h b/src/ostree/ot-main.h index 49e310e8..5f31b240 100644 --- a/src/ostree/ot-main.h +++ b/src/ostree/ot-main.h @@ -32,10 +32,22 @@ typedef enum { typedef struct { const char *name; - gboolean (*fn) (int argc, char **argv, OstreeRepo *repo, GCancellable *cancellable, GError **error); - int flags; /* OstreeBuiltinFlags */ + gboolean (*fn) (int argc, char **argv, GCancellable *cancellable, GError **error); } OstreeCommand; int ostree_run (int argc, char **argv, OstreeCommand *commands, GError **error); -int ostree_usage (char **argv, OstreeCommand *commands, gboolean is_error); +int ostree_usage (OstreeCommand *commands, gboolean is_error); + +gboolean ostree_option_context_parse (GOptionContext *context, + const GOptionEntry *main_entries, + int *argc, char ***argv, + OstreeBuiltinFlags flags, + OstreeRepo **out_repo, + GCancellable *cancellable, GError **error); + +gboolean ostree_admin_option_context_parse (GOptionContext *context, + const GOptionEntry *main_entries, + int *argc, char ***argv, + OstreeSysroot **out_sysroot, + GCancellable *cancellable, GError **error); |