From 79c3128fad66961ae88f2c5ff5a17cf8ffdc0aa7 Mon Sep 17 00:00:00 2001 From: Amir Husayn Panahifar Date: Tue, 25 Aug 2026 21:07:24 +0330 Subject: [PATCH] feat: add help command with available commands list --- src/commands/help.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/commands/help.ts diff --git a/src/commands/help.ts b/src/commands/help.ts new file mode 100644 index 0000000..968408c --- /dev/null +++ b/src/commands/help.ts @@ -0,0 +1,37 @@ +const helpObj = { + commands: [ + ["'about'", "Who am I?"], + ["'whoami'", "A perplexing question."], + ["'su'", ";D"], + ["'banner'", "Display the banner."], + ["'clear'", "Clear the terminal."], + ], +}; + +const createHelp = (): string[] => { + const help: string[] = []; + help.push("
"); + + helpObj.commands.forEach((ele) => { + const SPACE = " "; + let string = ""; + string += SPACE.repeat(2); + string += ""; + string += ele[0]; + string += ""; + string += SPACE.repeat(17 - ele[0].length); + string += ele[1]; + help.push(string); + }); + + help.push("
"); + help.push("Press [Tab] for auto completion."); + help.push("Press [Esc] to clear the input line."); + help.push( + "Press [↑][↓] to scroll through your history of commands." + ); + help.push("
"); + return help; +}; + +export const HELP = createHelp();