Implement utility function for formatting and printing errors

This commit is contained in:
2025-02-01 20:48:03 -05:00
parent 173574eb85
commit e9d0c37043
18 changed files with 84 additions and 159 deletions
+1 -3
View File
@@ -4,7 +4,6 @@ package core
import (
"fmt"
"os"
"os/exec"
"strings"
)
@@ -14,8 +13,7 @@ func copyString(continuous bool, copySubject string) {
cmd := exec.Command("powershell.exe", "-c", fmt.Sprintf("echo '%s' | Set-Clipboard", strings.ReplaceAll(copySubject, "'", "''")))
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError+"Failed to copy to clipboard:", err.Error()+AnsiReset)
os.Exit(ErrorClipboard)
PrintError("Failed to copy to clipboard: "+err.Error(), ErrorClipboard, true)
}
if !continuous {