All Projects → simonecorsi → Termly.js

simonecorsi / Termly.js

Licence: gpl-3.0
Simple, Extensible, Hackable and Lightweight Javascript Browser Terminal Simulator!

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects
bash
514 projects
js
455 projects
es2015
71 projects
es2016
15 projects

Projects that are alternatives of or similar to Termly.js

Cast Sh
📟 An instance of your terminal in your browser
Stars: ✭ 151 (+169.64%)
Mutual labels:  terminal, browser
Lulumi Browser
Lulumi-browser is a lightweight browser coded with Vue.js 2 and Electron.
Stars: ✭ 367 (+555.36%)
Mutual labels:  lightweight, browser
Spaceship Prompt
🚀⭐ A Zsh prompt for Astronauts
Stars: ✭ 15,748 (+28021.43%)
Mutual labels:  terminal, prompt
Mylittledom
High-level DOM-like terminal interface library
Stars: ✭ 116 (+107.14%)
Mutual labels:  terminal, browser
Dotfiles
Configurations for the tools I use every day
Stars: ✭ 898 (+1503.57%)
Mutual labels:  terminal, prompt
Pure
Pretty, minimal and fast ZSH prompt
Stars: ✭ 10,891 (+19348.21%)
Mutual labels:  terminal, prompt
Trueline
Fast and extensible bash powerline prompt with true color and fancy icon support
Stars: ✭ 271 (+383.93%)
Mutual labels:  terminal, prompt
Term Web
📟 A simple Terminal UI that run on the web
Stars: ✭ 77 (+37.5%)
Mutual labels:  terminal, browser
Typewritten
A minimal, lightweight, informative zsh prompt theme
Stars: ✭ 442 (+689.29%)
Mutual labels:  terminal, prompt
Amfora
A fancy terminal browser for the Gemini protocol.
Stars: ✭ 395 (+605.36%)
Mutual labels:  terminal, browser
Emacs Application Framework
A free/libre and open-source extensible framework that revolutionizes the graphical capabilities of Emacs, the key to ultimately Live in Emacs
Stars: ✭ 1,932 (+3350%)
Mutual labels:  terminal, browser
Dom99
Extend html with directives
Stars: ✭ 37 (-33.93%)
Mutual labels:  lightweight, browser
Leash
Browser Shell
Stars: ✭ 108 (+92.86%)
Mutual labels:  terminal, browser
Fancy Git
That's a simple prompt changer to show a few cool git informations about your repository on terminal. You can choose among 13 styles and enjoy all the aliases it provides you. Feel free for contributing, pull requests and issues are always welcome! ;)
Stars: ✭ 123 (+119.64%)
Mutual labels:  terminal, prompt
Tty Prompt
A beautiful and powerful interactive command line prompt
Stars: ✭ 1,210 (+2060.71%)
Mutual labels:  terminal, prompt
Gotty
Share your terminal as a web application
Stars: ✭ 16,070 (+28596.43%)
Mutual labels:  terminal, browser
Asciichart
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
Stars: ✭ 1,107 (+1876.79%)
Mutual labels:  terminal, browser
Go Prompt
Building powerful interactive prompts in Go, inspired by python-prompt-toolkit.
Stars: ✭ 4,255 (+7498.21%)
Mutual labels:  terminal, prompt
Prompt Checkbox
This repository has been archived, use Enquirer instead.
Stars: ✭ 21 (-62.5%)
Mutual labels:  terminal, prompt
Colorette
Easily set the color and style of text in the terminal.
Stars: ✭ 1,047 (+1769.64%)
Mutual labels:  terminal, browser

Termly.js

Simple, Extensible, Hackable and Lightweight Browser Terminal Simulator!

Want to showcase your new shiny CLI Tool you just released?
Want to write HowTos on how some commands behaves?
Want to create a simulated sandbox of linux-like commands to help people learn?
You want to have fun (as I had) making your personal website readable from a fake terminal?
Doit interactively!

Use inside a nice wrapper

Or calling directly to the class and building your own wrapper

Documentation

Installing

Get the zip Package directly or better:

npm install termly.js
# OR
yarn add termly.js
# OR
bower install termly.js

Getting Started

You can choose to use one of the two bundle coming with Termly.js, the main package have the shell only and all it's utilities you can use it as you wish, the prompt bundle is a simple DOM Wrapper that handles inputs and outputs and DOM manipulation, for the sake of simplicity with this you only have to attach a container and Style your terminal

<!-- Get the Shell only package -->
<script src="node_modules/termly.js/dist/termly.min.js"></script>

<!-- OR Get the Shell + a Prompt I/O wrapper -->
<script src="node_modules/termly.js/dist/termly-prompt.min.js"></script>

Or get directly from the sources (Babel+Bundler workflow)

// With a bundler
// @NB ES6 Classes are exported
const Shell = require('termly.js'); // Shell only
// OR
const Prompt = require('termly.js/bin/classes/Prompt'); // Init with a Prompt IO Wrapper

Read the docs to know the differences

Basic Usage

Both the Shell and the Prompt wrapper can get parameters at instantiation whose most important are a custom Filesystem and a set of custom commands, both fall back to defaults if not provided.

Using the Prompt Wrapper

You can attach Termly.js to a DOM container and have it do the work of creating and setting up input/output field and handlers and only care of styling it:

<script src="dist/termly-prompt.min.js"></script>
<script>
  // Documentation for options in the next section
  var shell = new TermlyPrompt('#container', {
    /* options object */
  });
</script>

Read the docs at website for all the options

Using the Shell Class

A more advanced approach to build something custom that suites your needs would be to use Termly.js Shell Class, thus extending it with a wrapper and handle yourself all the DOM Input/Output in the way you desire it to behave.

<script src="dist/termly.min.js"></script>
<script>
  // Documentation for options in the next section
  var shell = new Termly({
    /* options object */
  });
  shell.run('help');
  //> 'Commands available: help, whoami, about, arguments, cd, ls, cat, man, http'
</script>

Read the docs at website for all the options

Changelog

2.6.0 - stable

  • History: Added command history in localStorage, history command, and clear flag history -c to reset it.
    • Added arrow to navigate history from Prompt Wrapper

2.5.6

  • Prompt.js: Array output returned from commands execution now stringified

2.5.5

  • Fixed Filesystem methods cd-ing into files bug which cames with the change in how filesystem got inited some patch ago.

2.5.4

  • Fixed ENV object not getting the defaults if empty object

2.5.3

  • fixed printnev to print obejcts

2.5.2

  • added pwd command

2.5.1

  • Filesystem root dir structure instantialized as an instance of File()

2.5.0

  • Added Commands printenv and export
  • Added env object in shell class
    • You can provide an env: {} with all the variables you want set in shell.env at instantiation
    • You can see current session variables calling printenv
    • You can set a variable during runtime with export VAR=value or export var='long value'
  • fake user and hostname are taken from the provided env (or from default), no more in the options object

Contributing

Actually this fits my needs and it works as expected, but as someone pointed to my this can be useful so if you have nice ideas and you want to contribute get your copy and fiddle with!

If you have to open a PR if possible squash your commits before sending, so I can give it a look more easily.

If there are any issue let me know, I'll give it a look when I can.

Authors

Acknowledgments

minimist Got inspiration to write my command parser

Promise Polyfill

Fetch API Polyfill

Some CSS I got here and there for the demo because I get bored styling, I really don't remember from who sorry :( Thank you anyway

License

This project is licensed under the GNU GPL v3 License - see the LICENSE.md file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].