cape.console: Console and Prompt Tools

This module provides tools to interact with user prompts. In contains a function prompt_color() that handles the Python version dependence (input() vs raw_input()) and also provides a colorful prompt.

cape.console.prompt_color(txt, vdef=None, color='green')

Get user input using a colorized prompt

Call:
>>> v = prompt_color(txt, vdef=None)
Inputs:
txt: str

Text of the question on the same line as prompt

vdef: {None} | str

Default value (if any)

color: {"green"} | str

Color name

Outputs:
v: str

Raw (unevaluated) input from input() function

Versions:
  • 2018-08-23 @ddalle: Version 1.0