Shell Shock

A library for creating command line shell application.

Rationale

  • command line tools are faster and cooler than any gui or web interface

  • tab completion is awesome

  • cutting and pasting code is bad

Installation

gem install shell_shock

Usage

The basic idea is that you create classes and include the ShellShock::Context mixin. Start a shell by instantiating the class and executing the push method. Any number of nested shells may be pushed and exit falls back to the previous shell.

These classes represent a shell context with a number of commands registered. These commands are matched with tab completion. In addition to registered commands, ‘exit’, ‘quit’, ‘help’ and ‘?’ are always available.

Each command must have an execute method that accepts a string (the remaining content after the command name). Commands may also implement usage and help methods. They may also implement a completion method so may have arbitrarily complex completion rules per parameter.

Refer to the examples directory for some sample shells.