Go语言学习: clipboard/剪贴板/pbcopy/copy 包
读写系统剪贴板的包 clipboard
安装
go get golang.design/x/clipboard
main.go
- Write
- Read
package main
import (
"fmt"
"golang.design/x/clipboard"
)
func main() {
clipboard.Write(clipboard.FmtText, []byte("text data123123xyz"))
res := clipboard.Read(clipboard.FmtText)
fmt.Println(string(res))
}