mirror of
https://github.com/sern-handler/cli
synced 2026-06-06 01:16:53 +00:00
Merge branch 'main' of https://github.com/sern-handler/cli
This commit is contained in:
3
src/commands/help.js
Normal file
3
src/commands/help.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export function help() {
|
||||
console.log('This is sern cli help section\n\n' + 'Fill me up later!');
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user