Skip to content

Commit

Permalink
made wsh.js aware of its own location
Browse files Browse the repository at this point in the history
  • Loading branch information
benblank committed Apr 18, 2011
1 parent bec53ed commit b8fc5a8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions env/wsh.js
Expand Up @@ -56,24 +56,29 @@
} }
}; };


var scriptName = WScript.ScriptName;
var scriptPath = WScript.ScriptFullName;

scriptPath = scriptPath.substr(0, scriptPath.length - scriptName.length);

// load JSHint if the two scripts have not been concatenated // load JSHint if the two scripts have not been concatenated
if (typeof JSHINT === "undefined") eval(new ActiveXObject("Scripting.FileSystemObject").OpenTextFile("..\\jshint.js", 1).ReadAll()); if (typeof JSHINT === "undefined") eval(new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(scriptPath + "..\\jshint.js", 1).ReadAll());


var globals = {}; var globals = {};
var options = {}; var options = {};
var named = WScript.Arguments.Named; var named = WScript.Arguments.Named;
var unnamed = WScript.Arguments.Unnamed; var unnamed = WScript.Arguments.Unnamed;


if (unnamed.length !== 1) { if (unnamed.length !== 1) {
WScript.StdOut.WriteLine(" usage: cscript env/wsh.js [options] <script>"); WScript.StdOut.WriteLine(" usage: cscript " + scriptName + " [options] <script>");
WScript.StdOut.WriteLine(""); WScript.StdOut.WriteLine("");
WScript.StdOut.WriteLine("Scans the specified script with JSHint and reports any errors encountered. If"); WScript.StdOut.WriteLine("Scans the specified script with JSHint and reports any errors encountered. If");
WScript.StdOut.WriteLine("the script name is \"-\", it will be read from standard input instead."); WScript.StdOut.WriteLine("the script name is \"-\", it will be read from standard input instead.");
WScript.StdOut.WriteLine(""); WScript.StdOut.WriteLine("");
WScript.StdOut.WriteLine("JSHint configuration options can be passed in via optional, Windows-style"); WScript.StdOut.WriteLine("JSHint configuration options can be passed in via optional, Windows-style");
WScript.StdOut.WriteLine("arguments. For example:"); WScript.StdOut.WriteLine("arguments. For example:");
WScript.StdOut.WriteLine(" cscript env/wsh.js /jquery:true myscript.js"); WScript.StdOut.WriteLine(" cscript " + scriptName + " /jquery:true myscript.js");
WScript.StdOut.WriteLine(" cscript env/wsh.js /globals:QUnit:false,_:false,foo:true foo.js"); WScript.StdOut.WriteLine(" cscript " + scriptName + " /globals:QUnit:false,_:false,foo:true foo.js");


WScript.Quit(-1); WScript.Quit(-1);
} }
Expand Down

0 comments on commit b8fc5a8

Please sign in to comment.