Skip to content
This repository was archived by the owner on Oct 28, 2026. It is now read-only.
jesustorresdevPublic archive

About

Simple C++ framework for writing line-oriented command interpreters. It was thought mainly to assist students in their learning about operating systems topics.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

117 Commits

Folders and files

Repository files navigation

simpleshell

DOI

A C++ framework for writing line-oriented command interpreters in the style of a Unix shell.

The cli library parses each line the user types: commands, arguments, variable assignments, redirections (<, >, >>), pipes (|) and background execution (&). It then calls the functions the program has registered for each command.

Requirements

  • A C++ compiler with C++11 support
  • CMake 2.6 or later
  • Boost 1.44 or later
  • Doxygen (optional, only to build the documentation)

Building

cd build
cmake ..
make

The demo program is built as build/bin/simpleshell and the static library as build/lib/libcli.a.

To generate the API documentation, run make doc (requires Doxygen).

Usage

src/main.cpp is a complete example. The essentials are:

#include <cli/shell.hpp>

bool onCommand(const std::string& command, cli::ShellArguments const& arguments)
{
    // Run the command...
    return false;   // returning true ends the interpreter
}

int main()
{
    cli::ShellInterpreter interpreter;
    interpreter.promptText("$ ");
    interpreter.onRunCommand(&onCommand);
    interpreter.loop();
    return 0;
}

Layout

  • include/cli/ — public library headers
  • src/cli/ — library implementation
  • src/main.cpp — demo program
  • doc/ — Doxygen configuration

License

Copyright 2010-2016 Jesús Torres jmtorres@ull.es

Licensed under the Apache License 2.0.

About

Simple C++ framework for writing line-oriented command interpreters. It was thought mainly to assist students in their learning about operating systems topics.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages