Basic help command
This commit is contained in:
parent
4ef3575a13
commit
438d69c838
@ -1,3 +1,8 @@
|
||||
{
|
||||
"close": "exit"
|
||||
"close": "exit",
|
||||
"stop": "exit",
|
||||
"t": "target",
|
||||
"acc": "account",
|
||||
"d": "debug",
|
||||
"?": "help"
|
||||
}
|
@ -4,5 +4,5 @@ const c = new Logger("/exit", "blue");
|
||||
|
||||
export default async function handle(command: Command) {
|
||||
c.log("Good riddance!");
|
||||
process.exit(1);
|
||||
process.exit(0);
|
||||
}
|
16
src/commands/help.ts
Normal file
16
src/commands/help.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import Logger from "../util/Logger";
|
||||
import { Command } from "./Interface";
|
||||
import fs from 'fs';
|
||||
const c = new Logger("/help", "blue");
|
||||
|
||||
export default async function handle(command: Command) {
|
||||
const cmds = fs.readdirSync(__dirname);
|
||||
c.log(`${cmds.length} commands available:`)
|
||||
|
||||
cmds.forEach(cmd => {
|
||||
if (cmd.endsWith(".ts")) {
|
||||
const cmdName = cmd.replace(/.ts/gm, "");
|
||||
if (cmdName !== "Interface") c.trail(cmdName);
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user