Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2324910FAF for ; Mon, 17 Jun 2013 23:17:15 +0000 (UTC) Received: (qmail 68955 invoked by uid 500); 17 Jun 2013 23:17:15 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 68859 invoked by uid 500); 17 Jun 2013 23:17:15 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 68774 invoked by uid 99); 17 Jun 2013 23:17:14 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jun 2013 23:17:14 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BBB458A6658; Mon, 17 Jun 2013 23:17:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anis@apache.org To: commits@cordova.apache.org Date: Mon, 17 Jun 2013 23:17:15 -0000 Message-Id: <79e9cdd0eba84ec7abe131ea1950546a@git.apache.org> In-Reply-To: <0916b577acc64c45bc65d99f5e9cd6fd@git.apache.org> References: <0916b577acc64c45bc65d99f5e9cd6fd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/5] git commit: updating cli options and adding short hands 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 Authored: Mon Jun 17 15:57:52 2013 -0700 Committer: Anis Kadri 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();