src/jsdoc/PackerRun.vala
[roojspacker] / src / jsdoc / PackerRun.vala
index 8b67964..afbd34b 100644 (file)
@@ -25,48 +25,48 @@ namespace JSDOC
        class PackerRun : Application   
 #endif
        {
-               public static string opt_target = null;
-               public static string opt_debug_target = null;
-//             public static string opt_tmpdir = null;
-               private static string opt_basedir = null;
+               public  string opt_target = null;
+               public string opt_debug_target = null;
+//             public  string opt_tmpdir = null;
+               private  string opt_basedir = null;
                
                /**
                * @cfg baseDir -- prefix the files listed in indexfiles with this.
                */
                 
-               public static string opt_real_basedir = null;
-               
-               public static string opt_doc_target = null;
-               public static string opt_doc_template_dir = null;
+               public  string opt_real_basedir = null; // USE this one it's calcuated based on current path..
                
+               public  string opt_doc_target = null;
+               public  string opt_doc_template_dir = null;
+               public  bool opt_doc_include_private = false;           
                                
                [CCode (array_length = false, array_null_terminated = true)]
-               private static string[]? opt_files = null;
+               private string[]? opt_files = null;
                [CCode (array_length = false, array_null_terminated = true)]
-               private static string[]? opt_files_from = null;
+               private  string[]? opt_files_from = null;
                
                
-               public static bool opt_debug = false;
+               public  bool opt_debug = false;
                
                 /**
                 * @cfg {Boolean} opt_skip_scope (optional) skip Scope parsing and replacement.
                 *    usefull for debugging...
                 */
-               public static bool opt_skip_scope = false;
+               public  bool opt_skip_scope = false;
                
                /**
                 * @cfg {Boolean} opt_keep_whitespace (optional) do not remove white space in output.
                 *    usefull for debugging compressed files.
                 */
                
-               public static bool opt_keep_whitespace = false; 
+               public  bool opt_keep_whitespace = false;       
                
                        /**
                 * @cfg {Boolean} opt_dump_tokens (optional) read the first file and dump the tokens.
                 *    usefull for debugging...
                 */
                
-               public static bool opt_dump_tokens = false;     
+               public  bool opt_dump_tokens = false;   
                
                  
                /**
@@ -74,7 +74,11 @@ namespace JSDOC
                 *    Defaults to false if you set tmpDir, otherwise true.
                 */
                
-               public static bool opt_clean_cache = true;      
+               public  bool opt_clean_cache = true;    
+               
+               // not actually an option yet..
+               
+               public  string opt_doc_ext = "html";
                
                const OptionEntry[] options = {
                
@@ -90,6 +94,7 @@ namespace JSDOC
                        { "debug", 0, 0, OptionArg.NONE, ref opt_debug, "Show debug messages", null },
                        { "dump-tokens", 'k', 0, OptionArg.NONE, ref opt_dump_tokens, "Dump the tokens from a file", null },
                        { "clean-cache", 'c', 0, OptionArg.NONE, ref opt_clean_cache, "Clean up the cache after running (slower)", null },
+
                        // fixme -- keepwhite.. cleanup 
                        
                        // documentation options
@@ -103,46 +108,16 @@ namespace JSDOC
                        
                        { "doc-target", 'd', 0, OptionArg.STRING, ref opt_doc_target, "Documentation Directory target", null },
                        { "doc-template-dir", 'p', 0, OptionArg.STRING, ref opt_doc_template_dir, "Documentation Directory target", null },
-                       
+                       { "doc-private", 'p', 0, OptionArg.NONE, ref opt_doc_include_private, "Document Private functions", null },                                             
                        
                        
                        
                        { null }
                };
-               public static int main(string[] args) 
-               {
-                       //foreach(var a in args) {
-                       //      debug("ARG: %s\n", a);
-                       //}
-                       
-                       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);
-                                        
-                               }
-               
-                       new PackerRun(args);
-                       return 0;
-               }
-
+                 
 
        
-               public PackerRun (string[] args)
+               public PackerRun ()
                {
 #if !HAVE_OLD_GLIB             
                        Object(
@@ -151,7 +126,9 @@ namespace JSDOC
                        );
 #endif                                  
                         
-                       
+               }
+               public void  run()
+               {       
                        // what's required...
                        if (opt_debug) {
                                GLib.Log.set_handler(null, 
@@ -191,7 +168,7 @@ namespace JSDOC
                        
                        
                                // now run the Packer...
-                       var p = new Packer(                     );
+                       var p = new Packer(     this );
                        
                        
                        if (opt_files != null) {
@@ -219,8 +196,8 @@ namespace JSDOC
                                        stdout.printf ("%s", p.outstr);
                                }
                }
-               if (opt_doc_target) {
-                       var d = new DocBuilder(p);
+               if (opt_doc_target != null) {
+                       //var d = new DocBuilder(p);
                }