feat: add help command with available commands list

This commit is contained in:
ahp
2026-08-25 21:07:24 +03:30
parent dd4feff6a4
commit 79c3128fad
+37
View File
@@ -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("<br>");
helpObj.commands.forEach((ele) => {
const SPACE = "&nbsp;";
let string = "";
string += SPACE.repeat(2);
string += "<span class='command'>";
string += ele[0];
string += "</span>";
string += SPACE.repeat(17 - ele[0].length);
string += ele[1];
help.push(string);
});
help.push("<br>");
help.push("Press <span class='keys'>[Tab]</span> for auto completion.");
help.push("Press <span class='keys'>[Esc]</span> to clear the input line.");
help.push(
"Press <span class='keys'>[↑][↓]</span> to scroll through your history of commands."
);
help.push("<br>");
return help;
};
export const HELP = createHelp();