s11n.net
s11n is here to Save Our Data, man!
Project powered by:
SourceForge.net

eshell

A C++ library for writing shell-like console applications.

eshell is not technically part of the s11n project. It is presented here because:
  • It is often used as a testing ground for libs11n.
  • It has evolved to be fairly useful over the past 3 years.
  • It demonstrates s11n's usage. For example, it provides sessions support via s11n.
  • i've got nowhere else to publish it ;).
It is available for download from the libs page. Screenshots are available here (12k) and here (20k).

What is it? In short it's a framework for aiding in the creation of shell-like console applications. It takes over the tasks of user input collection and dispatches the input to a set of client-defined "command handlers".

It's main features are:
  • Provides an interface for getting input from the keyboard. If libreadline_cpp is linked in and supports GNU Readline 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 handler functions.
  • 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" eshell 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.
  • Provides app-wide access to command-line arguments passed in to main().
  • Provides full history/alias/environment persistance via session files.
  • Easy to work with and to integrate into new projects.
Development Status: 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.

License: it is released into the Public Domain. It is designed to be linked to libreadline_cpp (see below), 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 eshell supports if it's configure script finds it. It is available from the libs 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 eshell and readline_cpp are maintained.

So how do i use eshell?

You can start by Reading The Fine Manual. :)

Next, see the sample application in the source tree: src/test.cpp