Giter VIP home page Giter VIP logo

webshell's Introduction

webshell

The idea is to produce a web-based shell environment, using js-of-ocaml. The goal is to explore options for interacting with a system without the need for traditional a traditional terminal-based shell.

However, for backward compatibility there will need to be support for both. So the first step will be a terminal emulator.

A lot of interesting shell "add ons" can be supported by the terminal emulator, too. For instance, iTerm2 apparently does lots of cool things The history information it collects seems especially interesting.

Building

The project uses it's own "simple" (single file) build system, dbuild, written in ocaml. dbuild depends on:

  • ocamlfind
  • opam
  • core
  • async

To build dbuild:

  $ ./meta-build.sh

An example usage of dbuild to build some of the project:

  $ rm -rf .dbuild-sandbox/ \
    && ./dbuild \
         parallel-build \
         -poll \
         -sandbox \
         -spec .dbuild-spec \
         .dbuild/js/bin/linked/web_main.js-linked \
         .dbuild/native/bin/linked/{main,inline_test_runner}.native \
         .dbuild/native/odditty_kernel/linked/inline_test_runner.native \
         2>&1 \
    | tee /tmp/dbuild.log

Run tests with:

(eval $(opam config env --switch 4.03.0); .dbuild/native/odditty_kernel/linked/inline_test_runner.native inline-test-runner odditty_kernel -verbose)

Or, using jbuilder:

$ jbuilder build bin/main.exe bin/inline_test_runner.exe bin-js/web_main.bc.js --dev

And to run tests:

$./_build/default/bin/inline_test_runner.exe inline-test-runner odditty_kernel -verbose

Features of dbuild:

  • Parallel builds. ocamlbuild has issues with this, apparently.
  • Incremental rebuilds.
  • Polling. For "interactive" development.
  • Sandboxing. A clever idea from folks at Jane Street to ensure dependencies are defined correctly.
  • Uses the module aliases approach to building libraries (aka namespaces). This improves build parallelism and executable size. I'm unsure if this is easy to do with ocamlbuild. But Jane Street's jenga and jbuilder do this.
  • Multiple compilers support. Necessary to build native x86-64 and 32-bit javascript targets.
  • Simplicity. It fits in a single file, so it hopefully it's easy to understand and easy to extend and adapt. It has fewer dependencies than jenga.

On the other hand it has some glaring deficiencies:

  • Dynamic build rules aren't supported. So when the module dependencies of a file change you have to restart the build system.
  • It's a giant hack job.

Terminal Emulation

To run the emulator as a web server,

.dbuild/native/bin/linked/main.native server run -ws-port 8081

Then, open bin/index.html in a browser to attach to the emulator.

user hits keys -> os(?) -> terminal (emulator) -> application

application -> terminal (emulator) -> screen

  • sometimes the application sends characters to the terminal emulator which are just instructions to be interpreted by the emulator, e.g.

    • how to render the screen
    • how to translate key presses into chars interpretable by the application
    • queries to the emulator (e.g., send me the terminal ID)
  • the emulator can send more than just keys to the application's stdin:

    • mouse clicks
    • cursor positions

webshell's People

Contributors

datkin avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.