Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions scripts/diagnostics-viewer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S uv run --quiet --script
# /// script
# dependencies = ["textual>=0.87.0"]
# dependencies = ["textual>=0.87.0", "pyperclip"]
# ///
"""
WARNING: entirely vibe coded. use as a throwaway tool
Expand All @@ -17,6 +17,8 @@
from pathlib import Path
from typing import Optional, Any

import pyperclip

from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Static, Tree, ListView, ListItem, Label, Input
from textual.containers import Horizontal, Vertical, VerticalScroll, Container
Expand Down Expand Up @@ -145,6 +147,7 @@ class TextViewerModal(ModalScreen):

BINDINGS = [
Binding("escape,q,enter", "dismiss", "Close", show=True),
Binding("c", "copy", "Copy", show=True),
]

def __init__(self, title: str, text: str):
Expand All @@ -158,12 +161,17 @@ def compose(self) -> ComposeResult:
yield Static(f"[bold]{self.title}[/bold]", id="modal-title")
with VerticalScroll(id="modal-scroll"):
yield Static(self.text, id="modal-text")
yield Static("[dim]Press Escape, Q, or Enter to close[/dim]", id="modal-footer")
yield Static("[dim]Press C to copy, Escape/Q/Enter to close[/dim]", id="modal-footer")

def action_dismiss(self):
"""Dismiss the modal."""
self.app.pop_screen()

def action_copy(self):
"""Copy the text to clipboard."""
pyperclip.copy(self.text)
self.notify("Copied to clipboard")


class SearchOverlay(Container):
"""Search overlay widget."""
Expand Down
Loading