CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-asciimatics

A cross-platform package to replace curses (mouse/keyboard input & text colours/positioning) and create ASCII animations

81

1.32x
Overview
Eval results
Files

task.mdevals/scenario-4/

File Manager with Context Menu

Build a simple terminal-based file manager application that displays a list of files and allows users to interact with them via context menus and modal dialogs.

Requirements

Create a terminal application that:

  1. Displays a file list: Shows a list of files from the current directory in an interactive list widget
  2. Context menu: When the user right-clicks on a file, shows a popup menu with options: "View Info", "Delete", and "Cancel"
  3. Info dialog: When "View Info" is selected, displays a modal dialog showing the file name and size
  4. Delete confirmation: When "Delete" is selected, shows a confirmation modal dialog asking "Are you sure you want to delete [filename]?" with "Yes" and "No" buttons
  5. File deletion: If the user confirms deletion, remove the file from the list (simulate deletion - don't actually delete files)
  6. Exit option: Provides a way to exit the application (e.g., Escape key or 'q')

The application should handle terminal resizing gracefully and provide a clean user interface.

Implementation

@generates

API

def run_file_manager():
    """
    Main entry point for the file manager application.
    Displays files and handles user interactions via context menus and dialogs.
    """
    pass

if __name__ == "__main__":
    run_file_manager()

Test Cases

  • When the application starts, it displays a list of at least 3 sample files @test
  • When a user selects a file and triggers the context menu, it shows options including "View Info", "Delete", and "Cancel" @test
  • When "View Info" is selected from the context menu, a modal dialog appears showing file information @test
  • When "Delete" is selected, a confirmation modal dialog appears asking for confirmation @test
  • When deletion is confirmed, the file is removed from the displayed list @test

Dependencies { .dependencies }

asciimatics { .dependency }

Provides terminal UI capabilities including widgets, dialogs, and menus.

Install with Tessl CLI

npx tessl i tessl/pypi-asciimatics

tile.json