Okaara is a series of utilities for writing command line interfaces in Python. The provided functionality can be broken down into three categories: reading and writing utilities, an interactive shell framework, and a command line interface framework.
Okaara provides a wrapper around accepting user input and displaying output. At it’s most basic level, the read/write methods allow standard input/output to be replaced transparent from the code that uses them. More useful is the ability to script input and capture and tag output for use in unit tests.
In addition to being an abstraction from standard output, the Okaara prompt provides a number of utilities for more advanced output, such as:
The okaara prompt also may be configured to tag output written to it. This ability may be used in unit tests to assert the correct messages are being displayed to the user. More information and examples of this can be found on the prompt usage and examples page.
The other major piece of functionality in the Okaara prompt is comprised of a series of formatted prompts to request input from the user. A user prompt can be configured to allow or deny empty responses, allow the user to indicate the prompt has been aborted and no input was specificed, and capture a keyboard interrupt to allow the caller to react gracefully from it. Many prompt calls include input validation where applicable and will automatically reprompt the user in the event of an invalid input. The prompt functionality includes:
Okaara also provides a progress module for rendering progress indicators for long running operations. Progress bars and spinners are supported, both of which may be configured with custom rendering ticks and can automatically wrap an iterator to simplify the update of the widget.
Okaara provides the framework around creating interactive shell interfaces. A shell consists of one or more screens, each with their own menu of possible commands. Okaara provides the structure for navigating between screens, rendering of a screen’s menu, and accepting the appropriate trigger to execute a menu’s command.
In Okaara, a CLI provides the ability to structure and execute multiple, different commands to a single script. Commands may be grouped into sections to provide a flexible organizational structure for the provided functionality.
Built RPMs can be found in Fedora.
Source code can be found at: https://github.com/jdob/okaara/