Skip to content

BrundevCoder/web-terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

image

Web Terminal

Introducing my first web terminal! Although it doesn't work with all command types, I added some really cool custom ones, trying to mimic the aesthetics of a terminal with greenish colors to make it look like an older model :)

How it works

Basically, the code detects user input and checks if what they typed exists in an array of commands. If it does exist, it moves on to the next check, which is to discover the command and execute it. Otherwise, it throws an error such as:

image

What does each function in my script.js do?

  • addUserCommandToList: Adds the command that the user typed to the UI.
  • addCustomLineToList: Basically, this is where the output is initiated. It takes two parameters: the command to display, and the type... if it's an error, string, int.
  • clear: This command simply clears the entire terminal.
  • getRandomLetter: It generates a random number, retrieves the letter from an array, and returns it.
  • getRandomNumber: Same thing as getRandomLetter but for a number.
  • explode: Here we start the explosion function, basically it performs a 3-second countdown and removes a command from your console :P
  • exit: It simply clears the entire screen, like exiting a terminal.
  • uninstallCommands: It simply removes each command one by one, until there are none left; basically, the terminal loses its function.
  • handleCommands: This is the main function of the code, it handles the input and decides what to do with it.

More information:

  • If you click "Enter", it automatically sends your input, and at the end of the action, it returns focus to the input so you don't have to click it every time.

About

A web terminal, customized by me! (only works with the commands provided). Green terminal style.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors