from textual.widgets import Static import subprocess from maildir_gtd.actions.next import action_next def action_archive(app) -> None: """Archive the current email message.""" app.show_status(f"Archiving message {app.current_message_id}...") try: result = subprocess.run( ["himalaya", "message", "move", "Archives", str(app.current_message_id)], capture_output=True, text=True ) if result.returncode == 0: action_next(app) # Automatically show the next message else: app.show_status(f"Error archiving message: {result.stderr}", "error") except Exception as e: app.show_status(f"Error: {e}", "error")