Parse options (including --help) in headless mode (LP #1235662)
authorKevin Wasserman <kevin.wasserman@painless-security.com>
Tue, 15 Oct 2013 22:37:10 +0000 (18:37 -0400)
committerKevin Wasserman <kevin.wasserman@painless-security.com>
Tue, 15 Oct 2013 22:37:10 +0000 (18:37 -0400)
src/moonshot-identity-manager-app.vala

index 7e7878c..c8ad666 100644 (file)
@@ -332,6 +332,16 @@ public static int main(string[] args){
 #endif
 
         if (headless) {
+            try {
+                var opt_context = new OptionContext(null);
+                opt_context.set_help_enabled (true);
+                opt_context.add_main_entries (options, null);
+                opt_context.parse(ref args);
+            } catch (OptionError e) {
+                stdout.printf(_("error: %s\n"),e.message);
+                stdout.printf(_("Run '%s --help' to see a full list of available options\n"), args[0]);
+                return -1;
+            }
             explicitly_launched = false;
         } else {
             try {