<commit_before>
function create(args) {

}

module.exports = create;<commit_msg>Add init command to create plugins with templates<commit_after>var path = require('path');
var git = require('nodegit');
var folderExists = require('../tools/folderExists');
var isSdkDirectory = require('../tools/isSdkDirectory');
var rmDir = require('../tools/rmDir');


function init(args) {
  var cwd = process.cwd();

    var targetPath = path.join(cwd, 'plugins', args[1]);

    if (!isSdkDirectory()) {
      return console.log('\x1b[31mError: Please run this command in the SDKs root directory');
    }

    if (folderExists(targetPath)) {
      return console.log('\x1b[31mError: Plugin folder with that name already exists');
    }

    if (!args[1] || !args[2]) {
      return console.log('\x1b[31mError: Please provide a plugin name and plugin template');
    }

    console.log('\x1b[32mCreating Plugin ' + args[1] + '\x1b[0m');

    git.Clone('https://github.com/BuildFire/plugin-template-' + args[2] + '.git', targetPath)
    .then(function() {
      rmDir(path.join(targetPath, '.git'));

      console.log('');
      console.log('  \x1b[34mNext steps:');
      console.log('  \x1b[1m\x1b[37mcd plugins/' + args[1]);
      console.log('  \x1b[1m\x1b[37mnpm install');
      console.log('  \x1b[1m\x1b[37mnpm start');
    }).catch(err => console.error(err));
}

module.exports = init;
{'fraction_non_alphanumeric': 0.17561683599419448, 'fraction_numerical': 0.027576197387518143, 'mean_word_length': 3.62751677852349, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2516892', 'n_tokens_mistral': 487, 'n_tokens_neox': 469, 'n_words': 102}