From 7d7084494e1cbac517b0a77e38c24fd79ba51dce Mon Sep 17 00:00:00 2001 From: Ryan Hamilton Date: Fri, 28 Jun 2024 09:03:38 -0500 Subject: [PATCH] feat: Add SetClipboard function to utils for setting text to clipboard --- src/utils/utils.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/utils.go b/src/utils/utils.go index 39d2fbe..09e0f96 100644 --- a/src/utils/utils.go +++ b/src/utils/utils.go @@ -4,6 +4,8 @@ import ( "net" "os" "strings" + + "github.com/atotto/clipboard" ) func GetComputerName() string { @@ -56,3 +58,11 @@ func ConvertIPAddress(addrs []net.Addr) []string { } return ipaddress } + +// SetClipboard, returns error or nil + +func SetClipboard(text string) error { + // Set the clipboard to the text + // Get the clipboard from the clipboard package + return clipboard.WriteAll(text) +}