Python library to build pretty command line user prompts with interactive forms and validation
Overall
score
96%
Build a command-line menu system that allows users to navigate through options with configurable boundary behavior.
Create a function that displays an interactive menu with a list of options. The function should accept a parameter to control whether navigation cycles at list boundaries:
Cycling enabled: When the user navigates down from the last option, the cursor wraps to the first option. When navigating up from the first option, the cursor wraps to the last option.
Cycling disabled: When the user navigates down from the last option or up from the first option, the cursor remains at the boundary without wrapping.
The function should display a menu with at least 5 options and return the selected option as a string.
@generates
def run_menu(use_cycling: bool) -> str:
"""
Display an interactive menu with configurable cycling behavior.
Args:
use_cycling: If True, enable cursor wrapping at boundaries.
If False, cursor stops at boundaries.
Returns:
The selected menu option as a string.
"""
passProvides interactive command-line prompts with navigation capabilities.
Install with Tessl CLI
npx tessl i tessl/pypi-questionarydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10