In my Go language command line application, I need the ability to copy certain snippets of text to the system clipboard using Go. Basically something like PyperClip, but for Go.
I'm looking for a platform agnostic solution! Any help would be great :)
One project (just for Windows and Mac) seems approaching what you want:
atotto/clipboard
.Linux support is in this clipboard_linux.go class: a simple wrapper to
xsel --output/input --clipboard
system command.Another approach: try and take advantage of third-party libraries, like GLFW:
Its Go wrapper
glfw3
does provide aclipboard.go
file, with supposedly multi-platform methods.But that would be in the context of GLFW windows, not any shell window of course.