[rygel] core: Print help string on bad arguments to options
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Print help string on bad arguments to options
- Date: Tue, 19 Apr 2011 16:00:58 +0000 (UTC)
commit 11612857c3330ad06b44ae6921d580f99ecb84c6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Apr 19 18:59:43 2011 +0300
core: Print help string on bad arguments to options
src/rygel/rygel-cmdline-config.vala | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-cmdline-config.vala b/src/rygel/rygel-cmdline-config.vala
index a3c7c71..20ab6c1 100644
--- a/src/rygel/rygel-cmdline-config.vala
+++ b/src/rygel/rygel-cmdline-config.vala
@@ -125,7 +125,14 @@ internal class Rygel.CmdlineConfig : GLib.Object, Configuration {
opt_context.set_ignore_unknown_options (true);
opt_context.add_main_entries (options, null);
opt_context.add_group (Gst.init_get_option_group ());
- opt_context.parse (ref args);
+
+ try {
+ opt_context.parse (ref args);
+ } catch (OptionError.BAD_VALUE err) {
+ stdout.printf (opt_context.get_help (true, null));
+
+ throw new CmdlineConfigError.VERSION_ONLY ("");
+ }
if (version) {
stdout.printf ("%s\n", BuildConfig.PACKAGE_STRING);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]