Util.Clipboard behaviour (fnord v0.9.39)

View Source

Seam over the system clipboard. The Clipboard hex package shells out to the platform's clipboard utility (pbcopy/xclip/etc.), so copying is an outward-facing side effect: it overwrites whatever the user currently has on their clipboard. All clipboard writes route through this module so tests can substitute a Mox double instead of clobbering the developer's clipboard mid-suite. impl/0 resolves the :clipboard Globals key (same dispatch pattern as :http_client), defaulting to the passthrough in the sibling Default module.

Summary

Callbacks

Copies text to the system clipboard. Mirrors the hex package's contract: returns the input on success (so it can be piped), or an error tuple when no clipboard utility is available.

Callbacks

copy(t)

@callback copy(String.t()) :: String.t() | {:error, term()}

Copies text to the system clipboard. Mirrors the hex package's contract: returns the input on success (so it can be piped), or an error tuple when no clipboard utility is available.

Functions

copy(text)

@spec copy(String.t()) :: String.t() | {:error, term()}

impl()