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
10         class PackerRun : Application  
11         {
12                 const OptionEntry[] options = {
13                 
14                         
15                         { "target", 0, 0, OptionArg.STRING, ref opt_target, "Target File to write (eg. roojs.js)", null },
16                         { "tmpdir", 0, 0, OptionArg.STRING, ref opt_tmpdir, "Temporary Directory to use", null },
17                         { "file", 0, 0, OptionArg.STRING_ARRAY, ref opt_files ,"add a file to compile", null },
18                         { "files-from", 0, 0, OptionArg.STRING, ref opt_files_from ,"a text file listing files to compile", null },              
19  
20                         { "debug", 0, 0, OptionArg.NONE, ref opt_debug, "Show debug messages", null },
21                         { null }
22                 };
23                 public static string opt_target;
24                 public static string opt_tmpdir;
25                 
26                 
27                 public static string[] opt_files;
28                 public static string opt_files_from;
29                 public static bool opt_debug;
30                 
31                 // --------------- <<<<<<< <MAIN HERE....
32                 public static int main(string[] args) 
33                 {
34                         new PackerRun(args);
35                         return 0;
36                 }
37
38         
39                 public PackerRun (string[] args)
40                 {
41                 
42                         Object(
43                             application_id: "org.roojs.jsdoc.packerrun",
44                                 flags: ApplicationFlags.FLAGS_NONE
45                         );
46                                          
47                          
48                         var opt_context = new OptionContext ("JSDOC Packer");
49                         
50                         try {
51                                 opt_context.set_help_enabled (true);
52                                 opt_context.add_main_entries (options, null);
53                                 opt_context.parse (ref args);
54                                  
55                                 
56                         } catch (OptionError e) {
57                                 stdout.printf ("error: %s\n", e.message);
58                                 stdout.printf ("Run '%s --help' to see a full list of available command line options.\n %s", 
59                                                          args[0], opt_context.get_help(true,null));
60                                 GLib.Process.exit(Posix.EXIT_FAILURE);
61                                  
62                         }
63                         
64                         // now run the Packer...
65                         
66                         
67                 }       
68                 
69                 
70         }
71         
72 }