You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/01/10 22:39:15 UTC

git commit: cleaned up param parsing for 'help'

Updated Branches:
  refs/heads/master 6e9b38f24 -> 3b7e4acf5


cleaned up param parsing for 'help'


Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/3b7e4acf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/3b7e4acf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/3b7e4acf

Branch: refs/heads/master
Commit: 3b7e4acf58b10c226e61f15799c93a37563efb1d
Parents: 6e9b38f
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Jan 10 13:38:53 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Jan 10 13:38:53 2014 -0800

----------------------------------------------------------------------
 wp7/bin/check_reqs.js | 35 ++---------------------------------
 wp8/bin/check_reqs.js | 37 +++----------------------------------
 2 files changed, 5 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/3b7e4acf/wp7/bin/check_reqs.js
----------------------------------------------------------------------
diff --git a/wp7/bin/check_reqs.js b/wp7/bin/check_reqs.js
index ba397e2..4e673b1 100644
--- a/wp7/bin/check_reqs.js
+++ b/wp7/bin/check_reqs.js
@@ -39,45 +39,14 @@ function Log(msg, error) {
     }
 }
 
-// gets the output from a command, failing with the given error message
-function check_command(cmd, fail_msg) {
-    try {
-        var out = wscript_shell.Exec(cmd);
-    } catch(exception) {
-        Log(fail_msg, true);
-        WScript.Quit(1);
-    }
-    while (out.Status == 0) {
-        WScript.Sleep(100);
-    }
-
-    //Check that command executed
-    if (!out.StdErr.AtEndOfStream) {
-        var line = out.StdErr.ReadLine();
-        Log(fail_msg, true);
-        Log('Output : ' + line, true);
-        WScript.Quit(1);
-    }
-
-    if (!out.StdOut.AtEndOfStream) {
-        var line = out.StdOut.ReadAll();
-        return line;
-    }
-    else {
-         Log('Unable to get output from command "' + cmd + '"', true);
-         WScript.Quit(1);
-    }
-}
-
 if (args.Count() > 0) {
     // support help flags
-    if (args(0) == "--help" || args(0) == "/?" ||
-            args(0) == "help" || args(0) == "-help" || args(0) == "/help" || args(0) == "-h") {
+    if (args(0).indexOf("help") > -1 || args(0) == "/?" || args(0) == "-h") {
         Usage();
         WScript.Quit(1);
     }
     else {
-        Log('Error : Did not recognize argument ' + args(0), true)
+        Log('Error : Did not recognize argument ' + args(0), true);
         Usage();
         WScript.Quit(1);
     }

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/3b7e4acf/wp8/bin/check_reqs.js
----------------------------------------------------------------------
diff --git a/wp8/bin/check_reqs.js b/wp8/bin/check_reqs.js
index ba397e2..1aa8256 100644
--- a/wp8/bin/check_reqs.js
+++ b/wp8/bin/check_reqs.js
@@ -24,7 +24,7 @@ var wscript_shell = WScript.CreateObject("WScript.Shell");
 function Usage() {
     Log("Usage: [ check_reqs | cscript check_reqs.js ]");
     Log("examples:");
-    Log("    cscript C:\\Users\\anonymous\\cordova-wp7\\bin\\check_reqs.js");
+    Log("    cscript C:\\Users\\anonymous\\cordova-wp8\\bin\\check_reqs.js");
     Log("    CordovaWindowsPhone\\bin\\check_reqs");
 
 }
@@ -39,45 +39,14 @@ function Log(msg, error) {
     }
 }
 
-// gets the output from a command, failing with the given error message
-function check_command(cmd, fail_msg) {
-    try {
-        var out = wscript_shell.Exec(cmd);
-    } catch(exception) {
-        Log(fail_msg, true);
-        WScript.Quit(1);
-    }
-    while (out.Status == 0) {
-        WScript.Sleep(100);
-    }
-
-    //Check that command executed
-    if (!out.StdErr.AtEndOfStream) {
-        var line = out.StdErr.ReadLine();
-        Log(fail_msg, true);
-        Log('Output : ' + line, true);
-        WScript.Quit(1);
-    }
-
-    if (!out.StdOut.AtEndOfStream) {
-        var line = out.StdOut.ReadAll();
-        return line;
-    }
-    else {
-         Log('Unable to get output from command "' + cmd + '"', true);
-         WScript.Quit(1);
-    }
-}
-
 if (args.Count() > 0) {
     // support help flags
-    if (args(0) == "--help" || args(0) == "/?" ||
-            args(0) == "help" || args(0) == "-help" || args(0) == "/help" || args(0) == "-h") {
+    if (args(0).indexOf("help") > -1 || args(0) == "/?" || args(0) == "-h") {
         Usage();
         WScript.Quit(1);
     }
     else {
-        Log('Error : Did not recognize argument ' + args(0), true)
+        Log('Error : Did not recognize argument ' + args(0), true);
         Usage();
         WScript.Quit(1);
     }