Documentation
¶
Overview ¶
Package clipboard provides cross-platform clipboard copy utilities for the StackEye CLI. It supports macOS (pbcopy), Linux (xclip or xsel), and Windows (clip.exe), with a graceful fallback that prints the text when the clipboard is not available.
Usage:
if err := clipboard.Copy("se_abc123..."); err != nil {
// handle error
}
// Or with automatic fallback to printing the text:
clipboard.CopyOrPrint("se_abc123...")
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyText = fmt.Errorf("clipboard: text must not be empty")
ErrEmptyText is returned when an empty string is passed to Copy.
Functions ¶
func Copy ¶
Copy copies the given text to the system clipboard. It returns an error if the text is empty, the platform is unsupported, or the clipboard command fails.
func CopyOrPrint ¶
CopyOrPrint attempts to copy text to the clipboard. If the clipboard is unavailable or the copy fails, it prints the text to stderr so the user can copy it manually. This never returns an error for clipboard failures — only for invalid input.
Types ¶
This section is empty.