You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2013/12/20 20:38:35 UTC

git commit: CB-5688: found same problem with "cordova plugin"

Updated Branches:
  refs/heads/master 1f2347616 -> 6f16c20cb


CB-5688: found same problem with "cordova plugin"


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/6f16c20c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/6f16c20c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/6f16c20c

Branch: refs/heads/master
Commit: 6f16c20cb182fd281a8d94795bf7b377cfc3b9e8
Parents: 1f23476
Author: Marcel Kinard <cm...@gmail.com>
Authored: Fri Dec 20 14:36:36 2013 -0500
Committer: Marcel Kinard <cm...@gmail.com>
Committed: Fri Dec 20 14:36:36 2013 -0500

----------------------------------------------------------------------
 src/plugin.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6f16c20c/src/plugin.js
----------------------------------------------------------------------
diff --git a/src/plugin.js b/src/plugin.js
index b1c0e4f..d0edf78 100644
--- a/src/plugin.js
+++ b/src/plugin.js
@@ -72,6 +72,10 @@ module.exports = function plugin(command, targets) {
 
     switch(command) {
         case 'add':
+            if (!targets || !targets.length) {
+                return Q.reject(new Error('No plugin specified. Please specify a plugin to add. See "plugin search".'));
+            }
+
             return hooks.fire('before_plugin_add', opts)
             .then(function() {
                 return opts.plugins.reduce(function(soFar, target) {
@@ -126,12 +130,15 @@ module.exports = function plugin(command, targets) {
             break;
         case 'rm':
         case 'remove':
+            if (!targets || !targets.length) {
+                return Q.reject(new Error('No plugin specified. Please specify a plugin to remove. See "plugin list".'));
+            }
             return hooks.fire('before_plugin_rm', opts)
             .then(function() {
                 return opts.plugins.reduce(function(soFar, target) {
                     // Check if we have the plugin.
                     if (plugins.indexOf(target) < 0) {
-                        return Q.reject(new Error('Plugin "' + target + '" not added to project.'));
+                        return Q.reject(new Error('Plugin "' + target + '" is not present in the project. See "plugin list".'));
                     }
 
                     var targetPath = path.join(pluginPath, target);