JSDOC/PackerRun.vala
[gnome.introspection-doc-generator] / JSDOC / PackerRun.vala
1
2 /** 
3   the application
4   -- in theory this code  can be used as a library... but this is the standard command line version...
5 */
6
7 namespace JSDOC
8 {
9         // --------------- <<<<<<< <MAIN HERE....
10         public static int main(string[] args) 
11         {
12                 new PackerRun(args);
13                 return 0;
14         }
15
16
17         class PackerRun : Application  
18         {
19                 const OptionEntry[] options = {
20                 
21                         
22                         { "target", 0, 0, OptionArg.STRING, ref opt_target, "Target File to write (eg. roojs.js)", null },
23                         { "debug-target", 0, 0, OptionArg.STRING, ref opt_debug_target, "Target File to write debug code (eg. roojs-debug.js)", null },
24                         { "tmpdir", 0, 0, OptionArg.STRING, ref opt_tmpdir, "Temporary Directory to use", null },
25                         { "file", 0, 0, OptionArg.STRING_ARRAY, ref opt_files ,"add a file to compile", null },
26                         { "index-files", 0, 0, OptionArg.STRING, ref opt_files_from ,"a text file listing files to compile", null },             
27  
28                         { "debug", 0, 0, OptionArg.NONE, ref opt_debug, "Show debug messages", null },
29                         { null }
30                 };
31                 public static string opt_target = "";
32                 public static string opt_debug_target = "";
33                 public static string opt_tmpdir = "";
34                 
35                 
36                 public static string[] opt_files = {};
37                 public static string opt_files_from = "";
38                 public static bool opt_debug = false;
39                 
40
41
42         
43                 public PackerRun (string[] args)
44                 {
45                 
46                         Object(
47                             application_id: "org.roojs.jsdoc.packerrun",
48                                 flags: ApplicationFlags.FLAGS_NONE
49                         );
50                                          
51                          
52                         var opt_context = new OptionContext ("JSDOC Packer");
53                         
54                         try {
55                                 opt_context.set_help_enabled (true);
56                                 opt_context.add_main_entries (options, null);
57                                 opt_context.parse (ref args);
58                                  
59                                 
60                         } catch (OptionError e) {
61                                 stdout.printf ("error: %s\n", e.message);
62                                 stdout.printf ("Run '%s --help' to see a full list of available command line options.\n %s", 
63                                                          args[0], opt_context.get_help(true,null));
64                                 GLib.Process.exit(Posix.EXIT_FAILURE);
65                                  
66                         }
67                         // what's required...
68                         
69                         
70                         // now run the Packer...
71                         var p = new Packer(opt_target, opt_debug_target);
72                         if (opt_files.length > 0) {
73                                 p.loadFiles(opt_files);
74                         }
75                         p.
76                 }       
77                 
78                 
79         }
80         
81 }