Refactors site to use interactive terminal UI
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.
This commit is contained in:
parent
d22b4ec65a
commit
23369f4ace
46 changed files with 3524 additions and 860 deletions
41
assets/js/commands/core.js
Normal file
41
assets/js/commands/core.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// 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}`);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue