KrashDev.com

The Software Engineering Portfolio for Nathan Karasch

browser_cli

An extensible command line interface for the browser.

This project explored creating a command line interface that runs in the browser, combining two types of interfaces into a unique user experience. The application was written in Dart, a language developed by Google that transpiles to JavaScript to run in the browser.

The hardest part of the project was, of course, trying to replicate a bash command line with process management. For it to be useful to users at all, it needed to provide core functionality that users expect from a command line. Scope creep started to slow down development momentum, so eventually I had to nail down what features I wanted in release v1.0.0 and settle for additional features in later releases. The desired functionality for the first release was as follows:

  • Interactive IO
  • Process management
  • Environment variable storage, recall, and persistence
  • Command completion (via the tab key)
  • Input history (accessible with the up and down keys)
  • A set of standard library processes

The set of standard library processes in v1.0.0 includes:

authentication
loads user/session information from the document cookies and (in later versions) will authenticate the user’s credentials.
echo
prints the supplied input back to the shell.
export
creates a variable that persists across browser sessions via cookies.
help
offers help information for the command line interface.
jobs
lists all processes that are currently running.
printenv
prints all environment variables.
testinput
demonstrates how to get user input from within a process and how to call other commands from within a process.
unset
erases an environment variable.

View the full write-up

Code Repository
github.com/KrashLeviathan/browser_cli
Dart Package
pub.dartlang.org/packages/browser_cli
Live Demo
krashleviathan.github.io/browser_cli
Started
18 August 2016
Completed
27 September 2016