Giter Club home page Giter Club logo

qbsh's Introduction

qbsh icon

Docker Repository on Quay

QBSH - Quick BASIC Shell

This is an attempt at making a command line shell with QB64. Unhandled commands are offloaded to the native shell (bash, etc.). While it's reached a point of mild sanity, your mileage may vary, so use this at your own risk.

Try it with podman or docker:

podman run --pull=always --rm -it quay.io/vwbusguy/qbsh

Compiling

To compile this with qb64 (Windows users, use qb64.exe):

qb64 -x $PWD/qbsh.bas -o $PWD/qbsh

It's also possible to load this into the QB64 GUI and then press F11 to compile it from there if a GUI is preferred.

Containerize it

qbsh is now available through quay.io. You can now run it with podman or Docker:

podman run --pull=always --rm -it quay.io/vwbusguy/qbsh

Build it yourself

A portable Containerfile is provided for use in podman or docker with podman build -t qbsh . . Note that this is a multi-stage Containerfile so older Docker versions (such as in RHEL 7) will not work, but podman should generally work.

Once it's done, you can run it with:

podman run --rm -it localhost/qbsh

Shell Syntax

The syntax is very, well, basic. It's simple commands (usually upper-case) with simple arguments. If all else fails, it will attempt to run the command in the default system shell for the user (ie, bash, cmd, etc.), but anything interactive with the system shell likely won't work.

Commands

Typing "HELP" (or "help") will bring up a quick list of some command possibilities. While this is periodically updated, it is not an exhaustive list.

  • 8BALL - Answers to life's deepest questions
  • CALC - Add, Subtract, Multiply, and Divide
  • CHDIR - Change working directory (also, CD)
  • CLEAR - Clear the current screen
  • DATE - Today's Date
  • DELETE - Delete a file. (ERA and ERASE also work.)
  • DEVICES - Display info about attached input devices
  • ENV <Optional Key> - Print Environment
  • MAKEDIR <directory> - Make a new directory
  • OS - Print the operating system type
  • PIP <DEST>=<SRC> - Copy a file to a new path, CP/M style.
  • PLAY <Notes> - Make some music and rock out
  • PRINT - Output some text (is there an echo in here?)
  • RAND <Optional Limit> - Random number generator, defaults to 0-10 and supports negative numbers
  • READFILE <file> - Output some text file to terminal (cat and TYPE also work)
  • RENAME <File/Dir> <New Name> - Rename a file or directory (also, MOVE, NAME, or REN)
  • RMDIR <Directory> - Delete a directory
  • TIME - Current time
  • WHO AM I - Sometimes we all forget, right? (USER also works)

Commands can also be ran ad-hoc apart from scripting or interactive shell by passing them with qbsh -x.

Scripting

qbsh can be scripted using the above commands in a file. See the examples directory to get started. To run a script just run qbsh with the script file.

$ qbsh examples/hello.qsh

Scripts can be padded with empty lines or indents. To add comments, just begin the line with a single quote (').

Scripting specific commands

Additional commands specific to scripts:

  • LPRINT - Output some text without a new space after. Useful for chaining command outputs on the same line of output.

Development

Current code architecture is that the MAIN loop routes the input to the appropriate sub via GoSub and a loop, so no GoTo's are currently used. Eventually this may get big enough to refactor into other files, but for now all sub/labels are given alphabetically with a one line code comment above describing what they do.

Here's a list of low hanging fruit for ways this can be improved:

  • Optionally break out of the GUI window on launch and use existing terminal
  • Eliminate the file buffer from system shell calls as this is not great for security and less cross-compatible with Windows, etc.
  • Add native means of listing contents of the current directory
  • Add a means of storing output to a re-usable var in the shell
  • Feed commands through the shell in a script file
  • Ship container images on quay.io and/or Docker Hub

Testing

Run-time tests are in /test . They can be ran during Container build time with podman (or docker):

podman build --tag qbsh --skip-unused-stages=false .

How To Pronounce it

"Queue Bee Shell"

qbsh's People

Contributors

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