提交 83f8a781 编写于 作者: H hzlo_o

Fri Sep 15 17:10:01 CST 2023 inscode

上级 3fd48b21
run = "make" run = "make"
entrypoint = "main.go" entrypoint = "main.go"
language = "go"
[nix] [nix]
channel = "stable-22_11" channel = "stable-22_11"
[debugger]
program = "main.go"
module main module main
go 1.19 go 1.19
require github.com/atotto/clipboard v0.1.4 // indirect
无法预览此类型文件
package main package main
import ( import (
"fmt" "fmt"
"os/exec"
) )
func main() { func main() {
fmt.Println("Hello, World!") // 使用xclip获取剪贴板内容
// out, err := exec.Command("xclip", "-selection", "clipboard", "-o").Output()
//if err != nil {
// fmt.Println("Error reading clipboard:", err)
// return
//}
// 使用xsel获取剪贴板内容
out, err := exec.Command("xsel", "-b", "-o").Output()
if err != nil {
fmt.Println("Error reading clipboard:", err)
return
}
fmt.Println("剪贴板内容:", string(out))
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册