blob: 1425d9701b85fdf4126c05192ec1e8eeddaffa23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package util
import (
"fmt"
"log/slog"
"github.com/atotto/clipboard"
)
// Copies any object that has the Stringer interface to the clipboard
func Copy(str string) string {
if err := clipboard.WriteAll(str); err != nil {
slog.Error("Unable to copy item", "item", str, ErrKey, err)
return fmt.Sprintf("Copy operation failed: %v", err)
}
return fmt.Sprintf("Copied %s to clipboard!", str)
}
|