tsuru client plugins

Installing a plugin

Let’s install a plugin. There are two ways to install a plugin. The first wayis to move your plugin to $HOME/.tsuru/plugins. The other way is to use the commandtsuru plugin-install.

tsuru plugin-install will download the plugin file to$HOME/.tsuru/plugins. The syntax for this command is:

  1. $ tsuru plugin-install <plugin-name> <plugin-url>

Listing installed plugins

To list all installed plugins, users can use the command tsuru plugin-list:

  1. $ tsuru plugin-list
  2. plugin1
  3. plugin2

Executing a plugin

To execute a plugin just follow this pattern tsuru <plugin-name> <args>:

  1. $ tsuru <plugin-name>
  2. <plugin-output>

Removing a plugin

To remove a plugin just use the command tsuru plugin-remove passing thename of the plugin as argument:

  1. $ tsuru plugin-remove <plugin-name>
  2. Plugin "<plugin-name>" successfully removed!

Creating your own plugin

All you need to do is to create a new file that can be executed. You can useShell Script, Python, Ruby, etc.

As an example, we’re going to show how to create a Hello world plugin, thatjust prints “hello world!” in the screen. Let’s use Shell Script in thisplugin:

  1. #!/bin/bash -e
  2. echo "hello world!"

You can use the gist (https://gist.github.com) as host for your plugin, and runtsuru plugin-install to install it:

  1. $ tsuru plugin-install hello https://gist.githubusercontent.com/fsouza/702a767f48b0ceaafebe/raw/9bcdf9c015fda5ca410ca5eaf254a806bddfcab3/hello.bash

原文: https://docs.tsuru.io/1.6/using/cli/plugins.html