Giter Club home page Giter Club logo

webash's Introduction

webash

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.

Examples

Example web interfaces have been generated for a handful of common shell commands.

Quick Start & Installation

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.

  1. Install QuickServ.

  2. Clone this repository locally and cd into the repository root directory.

    git clone https://github.com/jstrieb/webash.git
    cd webash
  3. Optionally, allow the interface to run commands (arbitrary remote code execution on the server computer โ€“ very unsafe!) by uncommenting these lines in the code.

  4. Run quickserv in the repo root.

  5. Go to http://localhost:42069 in the browser.

  6. Pick a command-line program, and check out the generated interface.

Static HTML

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

Project Status & Contributing

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.

Known Issues

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.

Support the Project

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.

webash's People

Contributors

jstrieb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.