25 lines
389 B
Go
25 lines
389 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"golang.design/x/clipboard"
|
|
)
|
|
|
|
func main() {
|
|
var lines []string
|
|
|
|
err := clipboard.Init()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
ch := clipboard.Watch(context.TODO(), clipboard.FmtText)
|
|
for data := range ch {
|
|
lines = append(lines, string(data))
|
|
// fmt.Println(strings.Join(lines, "\n"))
|
|
fmt.Println(string(data))
|
|
}
|
|
}
|