{{!
    Template for command bin.
}}#!/usr/bin/env node

/**
 * {{pkg.name}} bin script.
 */

"use strict";

var program = require('commander'),
    pkg = require('../package'),
    {{command.name}} = require('../lib/{{command.name}}');

program
    .version(pkg['version']);

{{#with command}}
program
    .usage("[options] {{#each params}}<{{@key}}> {{/each}}")
{{#each alias}}    .alias('{{this}}')
{{/each}}    .description("{{description}}")
{{#each options}}    .option('-{{short}}, --{{@key}}{{#if type}} <{{@key}}>{{/if}}', "{{desc}}"){{#if @last}};{{/if}}
{{/each}}
{{/with}}

program
    .parse(process.argv);

{{#with command}}
{{#each params}}var {{@key}} = program.args[{{@index}}]{{#if @last}};{{else}},
{{/if}}{{/each}}
{{name}}({{#each params}}{{@key}}{{/each}}, {
{{#each options}}   {{@key}}: program.{{@key}}{{#if @last}}{{else}},
{{/if}}
{{/each}}

}, function (err) {
    if (err) {
        console.error(err);
    }
});
{{/with}}
