From 71cdc234ee468584efae62b443ea3786e516ba77 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Wed, 10 Apr 2019 21:21:55 +0200 Subject: [PATCH] Added clipboard. - Default implementation only copies to application memory. Is open for using external implementation. --- ui/clipboard.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ui/clipboard.go diff --git a/ui/clipboard.go b/ui/clipboard.go new file mode 100644 index 0000000..2d923aa --- /dev/null +++ b/ui/clipboard.go @@ -0,0 +1,23 @@ +package ui + +type Clipboard interface { + WriteText(t string) error + ReadText() (string, error) +} + +var DefaultClipboard Clipboard = &clipboard{} + +func SetClipboard(c Clipboard) { DefaultClipboard = c } + +type clipboard struct { + value string +} + +func (c *clipboard) WriteText(t string) error { + c.value = t + return nil +} + +func (c *clipboard) ReadText() (string, error) { + return c.value, nil +}