###API Connect Toolkit CLI

###Installation

To install this node module locally while developing run the following command:

```
%> cd apiconnect
%> npm link .
```

This will give you the basic commands required to create, and debug a
API Connect based node.js application and API gateway.

Additional plugins can be installed to access management and deployment functions.

```
%> apic plugins:install <plugin-name|URI>
```

###Creating plugins

1. Create a new node module and add 'apic-toolkit-plugin' to the keywords section.
1. Create a JS file which exports a list of commands. Eg:
```
var l = require('apiconnect-cli-logger');
var debug = require('debug')('test-plugin:say-hello');

exports.getTopics = function() {
  return [{
    name: 'intro',
    description: 'one line description of intro topic',
    commands: [{
      command: 'say-hello <name>',
      options: ['-l, --lang <language>'],
      helpInfo: function() {
        // Can also return a promise which resolves to text
        return fs.readFileSync(path.join(__dirname, 'some-help.txt'), 'utf8');
      },
      action: function(name, options) {
        debug('User passed in options %j');
        switch (options.lang) {
          case 'en':
            l.writeln('Hello %s', name);
            break;
          case 'zh':
            l.writeln('%s, 你好吗？', name);
            break;
          default:
            l.writeln('What lang is that?');
            break;
        }
        l.info('all done');
      }
    }],
  }];
};
```
1. In the `package.json` file, set the main property to point at the file created in the previous step.
```
...
  main: "index.js",
...
```
