We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Creating a Clipboard Copy Helper Function in Elixir's IEx
124
clicks
Source: shyr.io
The article discusses a common scenario where copying content from the terminal is necessary, and how macOS provides an easy way to do this with the 'pbcopy' command. However, in Elixir, there isn't a straightforward method to copy large terms. The author explains how the 'Port' module in Elixir's standard library can be used to interface with external commands and pipe data to them. The author then provides a 'copy/1' helper function which can be added to the '.iex.exs' file, making it automatically load whenever IEx starts. This helper function makes use of 'Port.open' and 'Port.command' to copy the text to the clipboard.
Related posts
© HashMerge 2024