This commit is contained in:
Jacob Nguyen
2022-05-09 12:23:08 -05:00
2 changed files with 10 additions and 1 deletions

3
src/commands/help.js Normal file
View File

@@ -0,0 +1,3 @@
export function help() {
console.log('This is sern cli help section\n\n' + 'Fill me up later!');
}

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env node
import { init } from './commands/init.js';
import { help } from './commands/help.js';
const regex = /(?<=--|-)\w+/gm;
const rawArgs = process.argv.slice(2);
const flags = rawArgs.join(' ').match(regex);
@@ -12,7 +14,11 @@ const args = rawArgs
.filter((e) => !/(--|-)\w+/gm.test(e));
const cmdName = args[0];
const commands = new Map([['init', init]]);
const commands = new Map([
['help', help],
['', help],
['init', init],
]);
const found = commands.get(cmdName);