File size: 391 Bytes
691dc7c
e99df76
691dc7c
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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