4 -- in theory this code can be used as a library... but this is the standard command line version...
9 // --------------- <<<<<<< <MAIN HERE....
12 class PackerRun : Application
14 public static string opt_target = "";
15 public static string opt_debug_target = "";
16 public static string opt_tmpdir = "";
18 [CCode (array_length = false, array_null_terminated = true)]
19 private static string[]? opt_files = null;
20 [CCode (array_length = false, array_null_terminated = true)]
21 private static string[]? opt_files_from = null;
22 public static bool opt_debug = false;
26 const OptionEntry[] options = {
28 { "jsfile", 'f', 0, OptionArg.FILENAME_ARRAY, ref opt_files ,"add a file to compile", null },
29 { "target", 't', 0, OptionArg.STRING, ref opt_target, "Target File to write (eg. roojs.js)", null },
30 { "debug-target", 'T', 0, OptionArg.STRING, ref opt_debug_target, "Target File to write debug code (eg. roojs-debug.js)", null },
31 { "tmpdir", 'm', 0, OptionArg.STRING, ref opt_tmpdir, "Temporary Directory to use", null },
33 { "index-files", 'i', 0, OptionArg.FILENAME_ARRAY, ref opt_files_from ,"files that contain listing of files to compile", null },
35 { "debug", 0, 0, OptionArg.NONE, ref opt_debug, "Show debug messages", null },
36 // fixme -- keepwhite.. cleanup
40 public static int main(string[] args)
42 foreach(var a in args) {
43 print("ARG: %s\n", a);
46 var opt_context = new OptionContext ("JSDOC Packer");
49 opt_context.set_help_enabled (true);
50 opt_context.add_main_entries (options, null);
51 if (!opt_context.parse ( ref args)) {
52 print("options parse error");
53 GLib.Process.exit(Posix.EXIT_FAILURE);
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);
73 public PackerRun (string[] args)
77 application_id: "org.roojs.jsdoc.packerrun",
78 flags: ApplicationFlags.HANDLES_COMMAND_LINE
85 GLib.Log.set_handler(null,
86 GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING,
88 print("%s: %s\n", dom, msg);
92 // now run the Packer...
93 var p = new Packer(opt_target, opt_debug_target);
94 if (opt_files != null) {
96 foreach (string f in opt_files) {
97 GLib.debug("Adding File %s", f);
101 GLib.debug("No files added");