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.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                         { "files-from", 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_tmpdir;
33                 
34                 
35                 public static string[] opt_files;
36                 public static string opt_files_from;
37                 public static bool opt_debug;
38                 
39
40
41         
42                 public PackerRun (string[] args)
43                 {
44                 
45                         Object(
46                             application_id: "org.roojs.jsdoc.packerrun",
47                                 flags: ApplicationFlags.FLAGS_NONE
48                         );
49                                          
50                          
51                         var opt_context = new OptionContext ("JSDOC Packer");
52                         
53                         try {
54                                 opt_context.set_help_enabled (true);
55                                 opt_context.add_main_entries (options, null);
56                                 opt_context.parse (ref args);
57                                  
58                                 
59                         } catch (OptionError e) {
60                                 stdout.printf ("error: %s\n", e.message);
61                                 stdout.printf ("Run '%s --help' to see a full list of available command line options.\n %s", 
62                                                          args[0], opt_context.get_help(true,null));
63                                 GLib.Process.exit(Posix.EXIT_FAILURE);
64                                  
65                         }
66                         // what's required...
67                         
68                         
69                         // now run the Packer...
70                         var p = new Packer(opt_target, opt_debugTarget);
71                         
72                 }       
73                 
74                 
75         }
76         
77 }