Skip to content

stefanholek/kmd

Repository files navigation

kmd

An interpreter framework

Overview

kmd allows to build command line driven shells with powerful tab-completion capabilities.

The kmd.Kmd class derives from cmd.Cmd and extends it in the following ways:

  1. Instead of Python's readline module, kmd.Kmd uses the alternative rl readline bindings.
  2. Setup and tear-down of the readline completer have been moved to preloop and postloop respectively. Subclasses must make sure to call their parents' implementations.
  3. Incomplete command names are automatically expanded if they are unique.
  4. Command aliases can be defined by extending the aliases dictionary. Alias names apply to all do_, complete_, and help_ attributes.
  5. Lines starting with '#' are treated as comments. The new comment method is invoked, receiving the line as argument.
  6. It is now possible to configure the shell_escape_chars. The default is '!'.
  7. If a history_file is set, kmd.Kmd loads and saves the history in preloop and postloop.
  8. The new run method encapsulates the full execution cycle of a Kmd.

Package Contents

kmd.Kmd
Implements the mechanics of a command shell, based on cmd.Cmd.
kmd.completions
Implements a set of ready-to-use completions.
kmd.quoting
Defines constants and functions for writing completions.

Documentation

For further details please refer to the API Documentation.

Development

kmd development is hosted on GitHub where it also has an issue tracker.

Installation

Installation requires Python 2.7 or higher.

Note: kmd uses the rl library which contains a C extension. It is a good idea to review its installation instructions and make sure all dependencies are in place.

To install the kmd package, type:

pip install kmd

About

An interpreter framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages