dheraingoud's picture
sync: upstream 9194f15 + custom addons (KeyRotator, RotatingChatTransport, sol/terra/luna, ScannerTrap, health, Py3.12 compat)
e99df76
Raw History Blame Contribute Delete
391 Bytes
from __future__ import annotations
"""Best-effort text copy for the diagnostic command."""
import pyperclip
class ClipboardUnavailable(Exception):
"""The current desktop cannot accept clipboard text."""
def copy_text(text: str) -> None:
try:
pyperclip.copy(text)
except (pyperclip.PyperclipException, OSError) as error:
raise ClipboardUnavailable from error