Skip to content

Instantly share code, notes, and snippets.

@wjx0820
Last active August 4, 2019 00:41
Show Gist options
  • Save wjx0820/418b70c4d208ebd6339986ac08cd19bf to your computer and use it in GitHub Desktop.
Save wjx0820/418b70c4d208ebd6339986ac08cd19bf to your computer and use it in GitHub Desktop.
mkdir命令行工具
const argv = require('minimist')(process.argv.slice(2));
const fse = require('fs-extra');
const { p, s } = argv;
if (!p|| !s) {
console.info('-p: problem number');
console.info('-s: solution name');
console.error('Please enter problem number and solution name.');
process.exit(-1);
}
const srcDir = `./src/problem${p}/${s}.js`;
const testDir = `./test/problem${p}/${s}.test.js`;
fse.ensureFileSync(srcDir);
fse.ensureFileSync(testDir);
console.info('Done!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment