16 lines
440 B
JavaScript
16 lines
440 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
exports.run = async (folder, args) => {
|
|
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'));
|
|
};
|
|
|
|
exports.assert = (args) {
|
|
assert(args.length == 1);
|
|
assert(typeof args[0] == 'string');
|
|
assert(/^[a-zA-Z]+$/u.test(args[0]))
|
|
}
|