Moves site from static HTML to a dynamic terminal interface. This commit represents a major overhaul, introducing: - A functional terminal emulator implemented in JavaScript. - Command parsing and execution framework. - Various terminal commands for navigation and utility functions. - SASS conversion. The old CSS and simple HTML are completely removed. A new Hugo theme is implemented.
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
// Core Commands Module
|
|
// These are essential commands for the terminal
|
|
|
|
// Help command
|
|
window.terminal.registerCommand("help", "Display available commands", () => {
|
|
window.terminal.print("Available commands:", "success");
|
|
window.terminal.print("");
|
|
|
|
const commands = Object.keys(window.terminal.commands).sort();
|
|
commands.forEach((cmd) => {
|
|
const desc = window.terminal.commands[cmd].description || "No description";
|
|
window.terminal.print(` ${cmd.padEnd(15)} - ${desc}`);
|
|
});
|
|
window.terminal.print("");
|
|
});
|
|
|
|
// Clear command
|
|
window.terminal.registerCommand("clear", "Clear the terminal screen", () => {
|
|
window.terminal.clear();
|
|
});
|
|
|
|
// Echo command
|
|
window.terminal.registerCommand("echo", "Echo text to the terminal", (args) => {
|
|
window.terminal.print(args.join(" "));
|
|
});
|
|
|
|
// History command
|
|
window.terminal.registerCommand("history", "Show command history", () => {
|
|
if (window.terminal.history.length === 0) {
|
|
window.terminal.print("No commands in history");
|
|
return;
|
|
}
|
|
|
|
window.terminal.print("Command history:", "info");
|
|
window.terminal.history
|
|
.slice()
|
|
.reverse()
|
|
.forEach((cmd, idx) => {
|
|
window.terminal.print(` ${idx + 1}. ${cmd}`);
|
|
});
|
|
});
|