src/jsdoc/PackerRun.vala
[roojspacker] / src / jsdoc / PackerRun.vala
index 5a63abd..25b6209 100644 (file)
@@ -20,9 +20,9 @@ namespace JSDOC
        // --------------- <<<<<<< <MAIN HERE....
        
 #if HAVE_OLD_GLIB
-       class PackerRun : Object 
+       public class PackerRun : Object 
 #else
-       class PackerRun : Application   
+       public class PackerRun : Application    
 #endif
        {
                public  string opt_target = null;
@@ -81,8 +81,7 @@ namespace JSDOC
                public  string opt_doc_ext = "html";
                
        
-               public   OptionEntry[] options;
-       
                public PackerRun ()
                {
 #if !HAVE_OLD_GLIB             
@@ -95,7 +94,7 @@ namespace JSDOC
                }
                void parseArgs(string[] args)
                {
-                       this.options     = {
+                       GLib.OptionEntry[] options       = {
                                OptionEntry() {
                                        long_name = "jsfile",
                                        short_name = 'f',
@@ -234,12 +233,33 @@ namespace JSDOC
                                        arg_data = &opt_doc_include_private,
                                        description = "Document Private functions",
                                        arg_description = null
-                               },              
-               };
+                               }
+                       };
+                       var opt_context = new OptionContext ("JSDOC Packer");
+
+                       try {
+                               opt_context.set_help_enabled (true);
+                               opt_context.add_main_entries (options, null);
+                               if (!opt_context.parse ( ref args)) {
+                                       print("options parse error");
+                                       GLib.Process.exit(Posix.EXIT_FAILURE);
+                               }
+
+
+                                
+
+                       } catch (OptionError e) {
+                               stdout.printf ("error: %s\n", e.message);
+                               stdout.printf ("Run '%s --help' to see a full list of available command line options.\n %s", 
+                                                        args[0], opt_context.get_help(true,null));
+                               GLib.Process.exit(Posix.EXIT_FAILURE);
+                                
+                       }
+                       
                                         
                         
                }
-               public void  run()
+               public void  runPack()
                {       
                        // what's required...
                        if (opt_debug) {