|Put a smile in your cloud|
Once you have installed a recent version of the "cf" tool, just invoking it without any parameters should display some help text on available commands and features. In the lower part of that text should be two sections related to plugins:
ADD/REMOVE PLUGIN REPOSITORY:
add-plugin-repo Add a new plugin repository
remove-plugin-repo Remove a plugin repository
list-plugin-repos List all the added plugin repositories
repo-plugins List all available plugins in specified repository or in all added repositories
plugins List all available plugin commands
install-plugin Install CLI plugin
uninstall-plugin Uninstall the plugin defined in command argument
The command "add-plugin-repo" allows to add new repositories from which plugins can be installed, "list-plugin-repos" lists those repositories already available in your environment. Try the following two commands to add the plugin repositories from Bluemix Public and from the Cloud Foundry community collection:
cf add-plugin-repo BluemixPublic http://plugins.ng.bluemix.net/
cf add-plugin-repo CF-Community http://plugins.cloudfoundry.org/
Once done, try the following command to list the repositories. It should return something like shown:
henrik>> cf list-plugin-repos
Repo Name Url
With the command "repo-plugins" it is possible to list all the available plugins ready to be installed. You can read more about them at the repository descriptions linked above. For switching quickly between my different Bluemix environments I have installed the "targets" plugin from the Cloud Foundry community repository:
henrik>> cf install-plugin targets -r CF-Community
**Attention: Plugins are binaries written by potentially untrusted authors. Install and use plugins at your own risk.**
Do you want to install the plugin targets? (y or n)> y
Looking up 'targets' from repository 'CF-Community'
8230816 bytes downloaded...
Installing plugin /tmp/cf-targets-plugin...
Plugin cf-targets v1.1.0 successfully installed.
After I am done when calling just "cf" again, there is a new section in the help text available:
INSTALLED PLUGIN COMMANDS:
targets List available targets
set-target Set current target
save-target Save current target
delete-target Delete a saved target
If you have more plugins installed then there will be more commands displayed. Using the "targets" plugin I can save the current environment, i.e., the Bluemix or Cloud Foundry instance I am logged into, and quickly can switch between the Bluemix Dallas (NG) and Bluemix London (EU-GB) platforms using the "set-target" command. "cf set-target eu" would replace several "cf api" and "cf login" commands and a lot of typing, great for scripting and more efficient work.