How to copy text to / from clipboard in Go?

In my Go language command line application, I need the ability to copy certain pieces of text to the system clipboard using Go. Basically something like PyperClip , but for Go.

I am looking for a platform agnostic solution! Any help would be great :)

+4
source share
1 answer

One project (for Windows and Mac) appears closer to what you want: atotto/clipboard.

Provide copy and paste to the clipboard for Go.

func ReadAll() (string, error)
func WriteAll(text string) error

Linux clipboard_linux.go class: xsel --output/input --clipboard.


: , GLFW:

, , OpenGL

Go glfw3 clipboard.go, .

func (w *Window) SetClipboardString(str string)
func (w *Window) GetClipboardString() (string, error)

GLFW, , .

+4

Source: https://habr.com/ru/post/1523593/


All Articles