Clipboard v0.2.1 Clipboard View Source

Copy and paste from system clipboard.

Wraps ports to system-specific utilities responsible for clipboard access. It uses the default clipboard utilities on macOS, Linux and Windows but can be configured to call any executable.

Link to this section Summary

Functions

Copy value to system clipboard

Copy value to system clipboard but throw exception if it fails

Return the contents of system clipboard

Return the contents of system clipboard but throw exception if it fails

Link to this section Functions

Link to this function copy(value) View Source
copy(iodata) :: iodata

Copy value to system clipboard.

The original value is always returned, so copy/1 can be used in pipelines.

Examples

iex> Clipboard.copy("Hello, World!")
"Hello, World!"

iex> Clipboard.copy(["Hello", "World!"])
["Hello", "World!"]

iex> "Hello, World!" |> Clipboard.copy() |> IO.puts()
"Hello, World"
Link to this function copy!(value) View Source
copy!(iodata) :: iodata | no_return

Copy value to system clipboard but throw exception if it fails.

Identical to copy/1, except raise an exception if the operation fails.

The operation may fail when running Clipboard on unsupported operating systems or with missing executables (check your config).

Return the contents of system clipboard.

Examples

iex> Clipboard.paste()
"Hello, World!"
Link to this function paste!() View Source
paste!() :: String.t | no_return

Return the contents of system clipboard but throw exception if it fails.

Identical to paste/1, except raise an exception if the operation fails.

The operation may fail when running Clipboard on unsupported operating systems or with missing executables (check your config).