Webash (web + bash) creates web interfaces for console applications by extracting flags and options from programs' help text. With webash, you can run shell commands from any phone or laptop without leaving the browser.
Webash is specifically built to be used with QuickServ, a simple web server with a fresh take on the common gateway interface (CGI).
QuickServ serves static files directly, but executes scripts and programs. It passes GET parameters to executing programs as command-line arguments, and passes POST data on standard input. Then, it responds to the user by wrapping any data echoed to the standard output with the correct MIME type and the appropriate HTTP headers (e.g., for CORS).
Using QuickServ, any console application becomes a web application back end with no additional changes. Before webash, creating a front end interface was the most tedious part of using QuickServ. Now, webash automates the process by creating web interfaces from any program's help text.
In other words, with QuickServ and webash, it is trivial to turn any console program into a web application with a functional front end and back end.
Webash, itself, is a portable, POSIX-compatible shell script that can be run offline to generate static HTML, or online via QuickServ to dynamically generate interfaces for console programs.
Example web interfaces have been generated for a handful of common shell commands.
For most use cases, webash should be used offline to generate an interface that
gets manually modified before being used with QuickServ. But for demonstration
purposes, the following steps will set up webash to dynamically generate
interfaces for any command line application on the host system's PATH
.
-
Clone this repository locally and
cd
into the repository root directory.git clone https://github.com/jstrieb/webash.git cd webash
-
Optionally, allow the interface to run commands (arbitrary remote code execution on the server computer โ very unsafe!) by uncommenting these lines in the code.
-
Run
quickserv
in the repo root. -
Go to http://localhost:42069 in the browser.
-
Pick a command-line program, and check out the generated interface.
It is safer to use webash to generate static HTML interfaces for individual console applications than to run it dynamically.
# Install webash into the PATH (only needs to be done once)
sudo curl \
--location \
-o /usr/local/bin/webash \
"https://github.com/jstrieb/webash/raw/master/index.sh"
sudo chmod +x /usr/local/bin/webash
# Generate HTML for your program with webash
webash links/my_program.py > index.html
# Run QuickServ to serve the front end and execute the back end
quickserv
This project is actively maintained, but no new features are planned. If there are no recent commits, it means that everything is running smoothly!
Please open an issue with any bugs, suggestions, or questions.
Webash can only automatically extract command-line arguments from the most common help text formats. It uses simple regular expression-based normalization and pattern matching, and is therefore somewhat brittle. It is also not particularly performant.
There are a few ways to support the project:
- Star the repository and follow me on GitHub
- Share and upvote on sites like Twitter, Reddit, and Hacker News
- Report any bugs, glitches, or errors that you find
- Build and share your own projects made with QuickServ
These things motivate me to to keep sharing what I build, and they provide validation that my work is appreciated! They also help me improve the project. Thanks in advance!
If you are insistent on spending money to show your support, I encourage you to instead make a generous donation to one of the following organizations. By advocating for Internet freedoms, organizations like these help me to feel comfortable releasing work publicly on the Web.