You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/06/19 23:50:46 UTC

git commit: adding search results

Updated Branches:
  refs/heads/plugman-registry bd1559899 -> 927ffc381


adding search results


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

Branch: refs/heads/plugman-registry
Commit: 927ffc381343ce7e7a737c7018ce2fc53a101a3e
Parents: bd15598
Author: Anis Kadri <an...@apache.org>
Authored: Wed Jun 19 14:50:33 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Jun 19 14:50:33 2013 -0700

----------------------------------------------------------------------
 main.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/927ffc38/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index a3cf53e..0a60a3d 100755
--- a/main.js
+++ b/main.js
@@ -89,7 +89,7 @@ else if (cli_opts.adduser) {
 else if (cli_opts.publish) {
   registry.use(config.registry, function(err) {
     registry.publish([cli_opts.plugin], function(err, d) {
-      if(err) return console.log('Error publishing plugin'); 
+      if(err) return console.log('Error publishing plugin', err); 
       console.log('plugin published');
     });
   });
@@ -104,12 +104,15 @@ else if (cli_opts.unpublish) {
 }
 else if (cli_opts.search) {
   registry.use(config.registry, function(err) {
-    registry.search(cli_opts.search.split(','), function(err, d) {
+    registry.search(cli_opts.search.split(','), function(err, plugins) {
       if(err) return console.log(err); 
+      for(var plugin in plugins) {
+        console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided'); 
+      }
     });
   });
 }
-else {
+else if(cli_opts.install) {
     var cli_variables = {}
     if (cli_opts.variable) {
         cli_opts.variable.forEach(function (variable) {
@@ -124,12 +127,14 @@ else {
         www_dir: cli_opts.www
     };
     plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
+} else {
+  printUsage();
 }
 
 function printUsage() {
     platforms = known_opts.platform.join('|');
     console.log('Usage\n-----');
-    console.log('Install a plugin (will fetch if cannot be found):\n\t' + package.name + ' --platform <'+ platforms +'> --project <directory> --plugin <name|path|url> [--www <directory>] [--plugins_dir <directory>] [--variable <name>=<value>]\n');
+    console.log('Install a plugin (will fetch if cannot be found):\n\t' + package.name + ' --install --platform <'+ platforms +'> --project <directory> --plugin <name|path|url> [--www <directory>] [--plugins_dir <directory>] [--variable <name>=<value>]\n');
     console.log('Uninstall a plugin:\n\t' + package.name + ' --uninstall --platform <'+ platforms +'> --project <directory> --plugin <id> [--www <directory>] [--plugins_dir <directory>]\n');
     console.log('\t--plugins_dir defaults to <project>/cordova/plugins, but can be any directory containing a subdirectory for each plugin');
     console.log('\n\t--www defaults to the project\'s www folder, but can be any directory where web assets should be installed into\n');