#terminal-interface #terminal #browser #abstraction-layer #web-apps

workflow-terminal

Terminal abstraction layer over Xterm.js and termion crates for creating terminal applications that function uniformly in native (console) and in browser (WASM32) environments

33 releases (10 breaking)

new 0.12.0 Apr 20, 2024
0.11.0 Feb 25, 2024
0.10.2 Dec 24, 2023
0.8.1 Nov 1, 2023
0.1.0 Sep 21, 2022

#54 in HTTP client

Download history 356/week @ 2024-01-01 180/week @ 2024-01-08 266/week @ 2024-01-15 444/week @ 2024-01-22 75/week @ 2024-01-29 76/week @ 2024-02-05 145/week @ 2024-02-12 197/week @ 2024-02-19 195/week @ 2024-02-26 53/week @ 2024-03-04 142/week @ 2024-03-11 60/week @ 2024-03-18 135/week @ 2024-03-25 126/week @ 2024-04-01 122/week @ 2024-04-08 332/week @ 2024-04-15

723 downloads per month
Used in 6 crates

MIT/Apache

720KB
7K SLoC

workflow-terminal

Part of the workflow-rs application framework.


Terminal and command line interface (a custom shell) that runs in the browser and in the native environment.

github crates.io docs.rs license

Overview

Workflow Terminal allows you to create a terminal interface that operates symmetrically in OS shell (console) as well as in the web browser. This crate is useful if you want to create a command-line interface for an application meant to run natively on bare metal and in the browser. This crate is especially useful for prototyping and testing wasm32 browser-compatible platform-neutral applications and crates.

This functionality is achieved by creating a terminal struct Terminal that simultaneously wraps:

  • Crossterm - for Native
  • XtermJS - for Web (Browser)
  • Termion (for Native) is also available as a crate feature, but Termion does not support Windows OS.

This crate only depends on a minimal set of other crates and has no external (JavaScript) dependencies. XtermJS es6 modules are injected directly into DOM during the Terminal initialization phase. This allows the terminal to be loaded using any http server without any additional configuration. (due to browser restrictions, WASM can not be loaded into a static page)

On the backend, you have a simple Cli trait which receives user-entered command line.

The Terminal interface also provides basic facilities such as prompt for user text and passwrod entry, access to command history and binding to logging facilities (in case you want to output to the termina outside of the terminal command callback).

Please note: this implementation is based on async Rust and is currently hard-wired to run on top of tokio in the console and uses wasm_bindgen and web-sys to interface with the browser environment.

Basic examples on using this crate can be found here: https://github.com/workflow-rs/workflow-rs/tree/master/examples/terminal

Dependencies

~18–34MB
~519K SLoC