adds boilerplate for cli

This commit is contained in:
James
2020-02-11 16:50:38 -05:00
parent 4154b54ab6
commit 2cbb72d5c6
2 changed files with 27 additions and 0 deletions

24
src/bin/index.js Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env node
const args = process.argv.slice(2);
const scriptIndex = args.findIndex(
x => x === 'build' || x === 'test',
);
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
switch (script) {
case 'build': {
console.log('building');
break;
}
case 'test': {
console.log('testing');
break;
}
default:
console.log(`Unknown script "${script}".`);
break;
}