1
0
Prechádzať zdrojové kódy

amberc.js: move handling of commandline parameters to amberc

Manfred Kroehnert 12 rokov pred
rodič
commit
004ff906d1
2 zmenil súbory, kde vykonal 8 pridanie a 4 odobranie
  1. 6 1
      bin/amberc
  2. 2 3
      bin/amberc.js

+ 6 - 1
bin/amberc

@@ -3,6 +3,11 @@
 var path = require('path');
 var amberc = require('./amberc.js');
 
+// get parameters passed to the command line script
+// discard the first two parameters which are the node binary and the script name
+var parameters = process.argv.slice(2);
+
+
 // Get Amber root directory from the location of this script so that
 // we can find the st and js directories etc.
 var amber_dir = path.normalize(path.join(path.dirname(process.argv[1]), '..'));
@@ -10,4 +15,4 @@ var amber_dir = path.normalize(path.join(path.dirname(process.argv[1]), '..'));
 var closure_jar = path.resolve(path.join(process.env['HOME'], 'compiler.jar'));
 
 var compiler = new amberc.Compiler(amber_dir, closure_jar);
-compiler.main();
+compiler.main(parameters);

+ 2 - 3
bin/amberc.js

@@ -124,13 +124,12 @@ var createDefaults = function(amber_dir, finished_callback){
  */
 AmberC.prototype.main = function(parameters, finished_callback) {
 	console.time('Compile Time');
-	var options = parameters || process.argv.slice(2);
 
-	if (1 > options.length) {
+	if (1 > parameters.length) {
 		this.usage();
 	} else {
 		this.defaults = createDefaults(this.amber_dir, finished_callback);
-		this.handle_options(options);
+		this.handle_options(parameters);
 		var self = this;
 		this.check_for_closure_compiler(function(){
 			self.collect_files(self.defaults.stFiles, self.defaults.jsFiles)