or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/questionary@2.1.x
tile.json

tessl/pypi-questionary

tessl install tessl/pypi-questionary@2.1.0

Python library to build pretty command line user prompts with interactive forms and validation

Agent Success

Agent success rate when using this tile

96%

Improvement

Agent success rate improvement when using this tile compared to baseline

1x

Baseline

Agent success rate without this tile

96%

task.mdevals/scenario-4/

Interactive Menu System

Build a command-line menu system that allows users to navigate through options with configurable boundary behavior.

Requirements

Menu Navigation

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.

Test Cases

  • When cycling mode is enabled and the user is on the last item, pressing down arrow moves to the first item @test
  • When cycling mode is disabled and the user is on the last item, pressing down arrow keeps the cursor on the last item @test
  • When cycling mode is enabled and the user is on the first item, pressing up arrow moves to the last item @test

Implementation

@generates

API

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.
    """
    pass

Dependencies { .dependencies }

questionary { .dependency }

Provides interactive command-line prompts with navigation capabilities.