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-8/

Command Autocomplete System

Build a command line tool that helps users discover and execute commands through an interactive autocomplete interface.

Requirements

Create a Python script that provides an interactive command selection interface with autocomplete functionality. The system should help users find and execute commands from a predefined list.

Command Database

The tool should support these commands:

  • list files - Lists all files in the current directory
  • list directories - Lists all directories in the current directory
  • search files - Searches for files by name pattern
  • show help - Displays help information
  • clear screen - Clears the terminal screen
  • print date - Prints the current date
  • print time - Prints the current time
  • exit program - Exits the tool

Functionality

  1. Interactive Selection: Present an interactive prompt asking "Select a command to execute:"

  2. Autocomplete Behavior:

    • Users should be able to type partial command text
    • The system should show matching suggestions as the user types
    • Matching should work for partial strings (e.g., typing "file" should match both "list files" and "search files")
    • Matching should be case-insensitive
  3. Command Execution: After selection, the tool should:

    • Print a message: "You selected: [command name]"
    • Print the command description
    • Not actually execute the command (just display what was selected)
  4. Program Flow: After displaying the selection, the program should exit normally

Implementation Details

@generates

Create a single Python script that implements this functionality. The script should be executable from the command line.

API

def get_command_choices():
    """
    Returns a list of command strings available for selection.

    Returns:
        list: A list of command name strings
    """
    pass

def get_command_description(command):
    """
    Returns the description for a given command.

    Args:
        command (str): The command name

    Returns:
        str: The command description
    """
    pass

def main():
    """
    Main entry point that presents the interactive command selector
    and handles the user's selection.
    """
    pass

Test Cases

  • When the user types "list" and selects "list files", the output should contain "You selected: list files" followed by "Lists all files in the current directory" @test

  • When the user types "time" and selects "print time", the output should contain "You selected: print time" followed by "Prints the current time" @test

  • The autocomplete should match "files" to both "list files" and "search files" (case-insensitive partial matching) @test

Dependencies { .dependencies }

questionary { .dependency }

Provides interactive command line prompts with autocomplete functionality.