From f5502201207442c5a721f0182096f3e50555615b Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Wed, 10 Apr 2019 21:43:11 +0200 Subject: [PATCH] Added (OS specific) clipboard implementation. - Based on github.com/atotto/clipboard. --- ui/clipboard/clipboard.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ui/clipboard/clipboard.go diff --git a/ui/clipboard/clipboard.go b/ui/clipboard/clipboard.go new file mode 100644 index 0000000..6f54900 --- /dev/null +++ b/ui/clipboard/clipboard.go @@ -0,0 +1,21 @@ +package clipboard + +import ( + clip "github.com/atotto/clipboard" // actual implementation + "opslag.de/schobers/zntg/ui" +) + +type clipboard struct { +} + +func (c clipboard) WriteText(t string) error { + return clip.WriteAll(t) +} + +func (c clipboard) ReadText() (string, error) { + return clip.ReadAll() +} + +func init() { + ui.DefaultClipboard = &clipboard{} +}