Python library to build pretty command line user prompts with interactive forms and validation
Overall
score
96%
Build a command line tool that helps users discover and execute commands through an interactive autocomplete interface.
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.
The tool should support these commands:
list files - Lists all files in the current directorylist directories - Lists all directories in the current directorysearch files - Searches for files by name patternshow help - Displays help informationclear screen - Clears the terminal screenprint date - Prints the current dateprint time - Prints the current timeexit program - Exits the toolInteractive Selection: Present an interactive prompt asking "Select a command to execute:"
Autocomplete Behavior:
Command Execution: After selection, the tool should:
Program Flow: After displaying the selection, the program should exit normally
@generates
Create a single Python script that implements this functionality. The script should be executable from the command line.
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.
"""
passWhen 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
Provides interactive command line prompts with autocomplete functionality.
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