cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/5] git commit: updating cli options and adding short hands
Date Mon, 17 Jun 2013 23:17:15 GMT
updating cli options and adding short hands


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/7156b0fd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/7156b0fd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/7156b0fd

Branch: refs/heads/plugman-registry
Commit: 7156b0fd7cd151f4b46496f1585af71b91af4cfb
Parents: 79f1488
Author: Anis Kadri <anis@apache.org>
Authored: Mon Jun 17 15:57:52 2013 -0700
Committer: Anis Kadri <anis@apache.org>
Committed: Mon Jun 17 15:57:52 2013 -0700

----------------------------------------------------------------------
 main.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/7156b0fd/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 77a6725..a3cf53e 100755
--- a/main.js
+++ b/main.js
@@ -37,15 +37,19 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7',
'wp8'
             , 'publish' : Boolean 
             , 'unpublish' : Boolean 
             , 'search' : String
-            , 'v' : Boolean
+            , 'version' : Boolean
+            , 'help' : Boolean
             , 'debug' : Boolean
             , 'plugins': path
             , 'link': Boolean
             , 'variable' : Array
             , 'www': path
             }, shortHands = { 'var' : 'variable' };
-
-var cli_opts = nopt(known_opts);
+var short_hands = {
+    "v": ["--version"]
+  , "h": ["--help"]
+}
+var cli_opts = nopt(known_opts, short_hands);
 
 // Default the plugins_dir to './cordova/plugins'.
 var plugins_dir;
@@ -62,8 +66,11 @@ process.on('uncaughtException', function(error){
     process.exit(1);
 });
 
-if (cli_opts.v) {
+if (cli_opts.version) {
     console.log(package.name + ' version ' + package.version);
+} 
+else if (cli_opts.help) {
+  printUsage();
 }
 else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) &&
(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
     printUsage();


Mime
View raw message