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