libshellish (formerly known as eshell) is a C++ library for adding
basic shell-style input support to applications. While it does not
add the complete power of a Unix shell to applications, it does
provide a simple, client-extendable framework for adding console-style
interactivity to software. It takes over the tasks of user input collection and
dispatches the input to a set of client-defined "command handlers".
Amongst other things, this is often useful when writing test
applications for libraries which have no native GUI.
libshellish has evolved to be fairly useful since its original creation
in 2001 and it is often used (by me) in the creation of test programs for C++ libraries.
Screenshots are available here
a much older screenshot
Its main features are:
- Provides an interface for getting input from the keyboard. If
libreadline_cpp is linked in
and supports GNU Readline or BSD editline then full command editing and\
command history are supported, otherwise it uses plain old std::cin.
- Allows clients to plug in their own commands by mapping
single-token strings (i.e., command names) to so-called command
- The "command handler" interface is modelled off of traditional C-style
argc/argv usage and common shell conventions, so it is easy to
understand. It is, of course, much more flexible and simpler to use
than the traditional argc/argv!
Comes with a number of built-in shell-like commands (cd, pwd, sleep,
which, alias, set/unset, etc.). Client-written extensions may be
distributed as DLLs, extending the "generic" shellish client application,
or as standalone shell-like apps.
- Supports command aliasing, either coded in client code or typed
in at the console.
- Provides support for doing environment-variable expansion on
arbitrary strings. e.g. "echo $HOME".
- Provides app-wide access to command-line arguments passed in to
- If the optional libs11n support is activated, it provides full
history/alias/environment persistance via session files.
- Easy to work with and to integrate into new projects.
- Provides a plugin framework which can load arbitrary DLLs. This is primarily used to
add new commands to the shell at runtime.
- The C++ STL is required.
- libreadline_cpp is highly recommended but not required. If it is not available then
shellish uses stdin for all user input, which means that no interactive command-line editing is possible,
nor will the command history be available.
- libs11n 1.2+ is optionally used for session support. It is not required, however.
let's call it "stable beta". The current architecture
has been in use since early 2004, and has steadily undergone improvements along
the way. The project itself was started in 2001, and it has evolved considerably
since then through three complete rewrites.
it is released into the Public Domain. It is designed
to be linked to libreadline_cpp
if the configure
script can find it. If it is linked against a fully-functional
readline_cpp then it links against GNU Readline and the resulting
binary then necessarily falls under the GNU GPL.
What is readline_cpp?
This is an optional - but
highly recommended - supplemental library which shellish supports if
its configure script finds it. It is available from its own page
readline_cpp offers a front-end for collecting input from the console,
and it supports GNU readline if it is available. Linking against GNU
readline necessarily causes the resulting binaries to be released
under the GNU General Public License (GPL), and using that support
will change the license under which your copies of shellish and
readline_cpp are maintained.
While the source tarball is quite large, half of it is the build-related files.
So how do i use shellish?
You can start by Reading The Fine Manual
That manual is quite out of date, from when this software was called "eshell". The overview it
gives is still accurate, however. It may just be simpler to look at the two sample applications
in the source tree, src/shellish/client.cpp
Known bugs and shortcomings