cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [07/50] git commit: updating cli options and adding short hands
Date Sun, 28 Jul 2013 00:55:29 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/c7a0ff9a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/c7a0ff9a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/c7a0ff9a

Branch: refs/heads/master
Commit: c7a0ff9a88c50156be95d330e90f4e3922beb35d
Parents: 587808c
Author: Anis Kadri <anis@apache.org>
Authored: Mon Jun 17 15:57:52 2013 -0700
Committer: Anis Kadri <anis@apache.org>
Committed: Thu Jul 11 13:12:38 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c7a0ff9a/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index a4bac95..7baebe6 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;
@@ -66,8 +70,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)) {
     plugman.help();


Mime
View raw message