An interactive web console supporting commands, autocomplete, and theme switching.
This project provides a web-based console that can interpret and execute commands. It supports autocomplete, theming, and is extendable via plugins.
- Support for multiple themes.
- Autocomplete and command suggestions.
- Extendable with custom plugins.
- Example plugins include date/time, web search, and weather display.
A modern web browser and, if hosted locally, a web server (e.g., http-server
).
-
Clone the repository:
git clone https://github.com/username/repository-name.git cd repository-name
-
Ensure required files are present:
Make sure all files (index.html
,console.js
,console.css
,apps/
) are included. -
Start a local server:
Use a static server likehttp-server
or openindex.html
directly in your browser:http-server .
-
Optional: Customize existing plugins or themes.
-
Enter console commands:
Type commands in the input field at the bottom of the page. -
Use autocomplete:
Suggestions for available commands appear as you type. -
Check output:
Results and error messages are displayed in the main console area.
-
help
Description: Displays a list of all available commands. -
theme [name]
Description: Changes the console's color scheme.
-
time [format]
Description: Displays the current time in the specified locale (e.g.,en
,de
, etc.). -
date [format]
Description: Displays the current date in the specified locale (e.g.,en
,de
, etc.). -
search [query*]
Description: Performs a web search using DuckDuckGo. -
weather [city]
Description: Displays the current weather for the specified city.
The console supports the following themes:
- dark
- neutral
- twilight
- serene
- earth
- calm
- forest
Use the following command to change the theme:
theme [name]
Example:
theme dark
The apps
structure allows for easily adding new commands.
Navigate to the apps
folder and create a new .js
file, e.g., example.js
.
Add the command to the new file:
registerCommand("example [argument]", "Description of the command", (args) => {
print(`Argument passed: ${args[0]}`);
});
"example [argument]"
: Name and syntax of the command."Description of the command"
: Description displayed in thehelp
list.(args) => {}
: Logic for the command;args
contains user-provided arguments.
Open apps/apps.json
and add the new file:
["default.js", "time.js", "weather.js", "search.js", "example.js"]
Reload the page. The new command will be automatically recognized.
A command to calculate the square root:
registerCommand("sqrt [number]", "Calculates the square root of a number", (args) => {
const number = parseFloat(args[0]);
if (isNaN(number)) {
print("Please enter a valid number!");
return;
}
print(`The square root of ${number} is ${Math.sqrt(number)}`);
});
This command will be available immediately after adding it to apps.json
.
MIT License
MIT License
Copyright (c) 2024 Nodeblox
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.