16 lines
459 B
JavaScript
Raw Normal View History

2020-01-15 11:50:44 +01:00
const fs = require ('fs');
const path = require ('path');
2020-01-15 11:40:33 +01:00
exports.run = async (folder, args) => {
2020-01-15 11:50:44 +01:00
const snipFolder = path.join (folder, args[0]);
const template = path.join (__dirname, 'template');
fs.mkdir (snipFolder);
fs.copy (path.join (template, 'index.js'), path.join (snipFolder, 'index.js'));
2020-01-15 11:40:33 +01:00
};
2020-01-15 11:50:44 +01:00
exports.assert = (args) => {
assert (args.length == 1);
assert (typeof args[0] === 'string');
assert ((/^[a-zA-Z]+$/u).test (args[0]));
};