0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
This is just some code extracted from a few command line gems i've created (shh and cardigan). I wanted to move the shared functionality (related to creating a shell with readline) to a seperate gem.'
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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.