feat: added help command

This commit is contained in:
qxb3
2022-05-09 23:56:27 +08:00
committed by EvolutionX
parent 66e2c5f393
commit ca23d17670
2 changed files with 13 additions and 1 deletions

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

@@ -0,0 +1,6 @@
export default function () {
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 flags = process.argv.slice(2).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);