Implement untested MacOS clipboard support via pbcopy

This commit is contained in:
2024-03-03 22:36:20 -05:00
parent 207a4762b6
commit 0e6210f1af
4 changed files with 79 additions and 6 deletions
+1 -3
View File
@@ -10,8 +10,6 @@ import (
"time"
)
// TODO Avoid index out of range errors when copying fields that do not exist
// CopyField copies a field from an entry to the clipboard
func CopyField(targetLocation string, field int, executableName string) {
if isFile, _ := TargetIsFile(targetLocation, true); isFile {
@@ -49,12 +47,12 @@ func CopyField(targetLocation string, field int, executableName string) {
} else {
fmt.Println(AnsiError + "Failed to read \"" + targetLocation + "\" - it is a directory" + AnsiReset)
os.Exit(1)
}
os.Exit(0)
}
// ClipClear is called in a separate process to clear the clipboard after 30 seconds
// TODO Make clear time period configurable
func ClipClear(oldContents string) {
time.Sleep(30 * time.Second)