From bdaaf0906c64f28abbf782f1c8f6fbe71d443ba3 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 1 Jun 2025 17:04:27 -0400 Subject: [PATCH] Bump libmutton/go-boilerplate --- go.mod | 4 ++-- go.sum | 8 ++++---- mutn.go | 22 +++++++++++----------- src/cli/add.go | 2 +- src/cli/edit.go | 10 +++++----- src/cli/entryList.go | 2 +- src/cli/entryReader.go | 6 +++--- src/cli/utilitiesMisc.go | 4 ++-- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/go.mod b/go.mod index 13b0b9b..76fb613 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.24.3 require ( github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514 github.com/charmbracelet/glamour v0.7.0 - github.com/rwinkhart/go-boilerplate v0.0.0-20250601184813-71b5056ca6b3 - github.com/rwinkhart/libmutton v0.3.2-0.20250601204024-ca4913f0546a + github.com/rwinkhart/go-boilerplate v0.0.0-20250601205829-83b0be1379fd + github.com/rwinkhart/libmutton v0.3.2-0.20250601210140-c0f55156d8a9 golang.org/x/term v0.32.0 ) diff --git a/go.sum b/go.sum index 62baa6f..b2c9888 100644 --- a/go.sum +++ b/go.sum @@ -57,12 +57,12 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rwinkhart/convertroman v0.2.0 h1:otUm939eXT77q/Lr31mJtMwVWEw0RjEUB71gO65h9OM= github.com/rwinkhart/convertroman v0.2.0/go.mod h1:Af6HqvX0EIM4Y3HcnNXbbRey1dLasGB7WU0+3Cowgmw= -github.com/rwinkhart/go-boilerplate v0.0.0-20250601184813-71b5056ca6b3 h1:QgmV+Om1Z1Ix+nO6k9RRIzLpevkeeyrmCspIKysvsc4= -github.com/rwinkhart/go-boilerplate v0.0.0-20250601184813-71b5056ca6b3/go.mod h1:cnzIF45I0FCOvE4YIB+26pLCUx2kWyY2llKYZruNaRY= +github.com/rwinkhart/go-boilerplate v0.0.0-20250601205829-83b0be1379fd h1:qUFlOLvBx/dzQBW/zgFjSJ2EjrFb/lOQXs9q0sDW05g= +github.com/rwinkhart/go-boilerplate v0.0.0-20250601205829-83b0be1379fd/go.mod h1:cnzIF45I0FCOvE4YIB+26pLCUx2kWyY2llKYZruNaRY= github.com/rwinkhart/go-winio-easy-pipe-handles v0.0.0-20250407031321-96994a0e8410 h1:NhHwFM3Pgm6zRUfFKvi0p5ndjfFbVWsRwmmhyFlG4PE= github.com/rwinkhart/go-winio-easy-pipe-handles v0.0.0-20250407031321-96994a0e8410/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/rwinkhart/libmutton v0.3.2-0.20250601204024-ca4913f0546a h1:J6MhbSp+n0z2dBP5t0aY9OaOjZ0E4KC2Mnca6n/zUy8= -github.com/rwinkhart/libmutton v0.3.2-0.20250601204024-ca4913f0546a/go.mod h1:npc39dSGbmN6s4XFIi1KKlKQ2PD61fz54WcvJHfMx3o= +github.com/rwinkhart/libmutton v0.3.2-0.20250601210140-c0f55156d8a9 h1:zU+oB0UJyYNW/A1an8oEzKQ8G8EaHJQMbTtkmXV72YU= +github.com/rwinkhart/libmutton v0.3.2-0.20250601210140-c0f55156d8a9/go.mod h1:3yxNX+KoxDQBg2C4DKu8/WXOALfeql46Q5CKUdv4dIk= github.com/rwinkhart/peercred-mini v0.1.0 h1:TiS6u8cEWzW55S9X4iVpU72Iuy/NG6rMUJMtUEVEFLw= github.com/rwinkhart/peercred-mini v0.1.0/go.mod h1:+x4Mxc2veE+YePSOpcUasjimh7n799c1KraLuQwHR20= github.com/rwinkhart/rcw v0.2.0 h1:/rFgJ+20OSThipKAX5KPwW2xbPpgh1zl49THmEkkPis= diff --git a/mutn.go b/mutn.go index 91ce005..fad2f4d 100644 --- a/mutn.go +++ b/mutn.go @@ -48,7 +48,7 @@ func main() { case "copy": err := core.CopyArgument(targetLocation, 0) if err != nil { - other.PrintError("Failed to copy passphrase to clipboard: "+err.Error(), global.ErrorClipboard, true) + other.PrintError("Failed to copy passphrase to clipboard: "+err.Error(), global.ErrorClipboard) } case "edit": cli.EditEntryField(targetLocation, true, 0) @@ -59,7 +59,7 @@ func main() { case "shear": err := syncclient.ShearRemoteFromClient(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory if err != nil { - other.PrintError("Failed to shear target: "+err.Error(), back.ErrorWrite, true) + other.PrintError("Failed to shear target: "+err.Error(), back.ErrorWrite) } default: cli.HelpMain() @@ -98,7 +98,7 @@ func main() { } err := core.CopyArgument(targetLocation, field) if err != nil { - other.PrintError("Failed to copy field to clipboard: "+err.Error(), global.ErrorClipboard, true) + other.PrintError("Failed to copy field to clipboard: "+err.Error(), global.ErrorClipboard) } case "edit": var field int // indicates which (numbered) field to edit @@ -116,7 +116,7 @@ func main() { case "rename", "-r": isAccessible, _ := back.TargetIsFile(targetLocation, true) // error is ignored because dir/file status is irrelevant if !isAccessible { - other.PrintError("Failed to access location ("+targetLocation+")", back.ErrorTargetNotFound, true) + other.PrintError("Failed to access location ("+targetLocation+")", back.ErrorTargetNotFound) } cli.RenameCli(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory default: @@ -167,7 +167,7 @@ func main() { case "folder", "-f": err := syncclient.AddFolderRemoteFromClient(args[1]) // pass the incomplete path as the server will have a different home directory if err != nil { - other.PrintError("Failed to add folder: "+err.Error(), back.ErrorWrite, true) + other.PrintError("Failed to add folder: "+err.Error(), back.ErrorWrite) } default: cli.HelpAdd() @@ -183,21 +183,21 @@ func main() { case "clipclear": err := core.ClipClearArgument() if err != nil { - other.PrintError("Failure occurred in clipboard clearing process: "+err.Error(), global.ErrorClipboard, true) + other.PrintError("Failure occurred in clipboard clearing process: "+err.Error(), global.ErrorClipboard) } case "startrcwd": crypt.RCWDArgument() case "sync": _, err := syncclient.RunJob(true) if err != nil { - other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess, true) + other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess) } case "init": err := core.LibmuttonInit(front.Input, [][3]string{{"MUTN", "textEditor", cmp.Or(front.Input("Text editor (leave blank for $EDITOR, falls back to \""+cli.FallbackEditor+"\"):"), os.Getenv("EDITOR"), cli.FallbackEditor)}}, confirmRCWPassphrase("new"), false) if err != nil { - other.PrintError("Initialization failed: "+err.Error(), 0, true) + other.PrintError("Initialization failed: "+err.Error(), 0) } case "tweak": choice := front.InputMenuGen("Action:", []string{"Change device ID", "Change master passphrase/Optimize entries"}) @@ -205,11 +205,11 @@ func main() { case 1: oldDeviceID, err := global.GetCurrentDeviceID() if err != nil { - other.PrintError("Failed to get current device ID: "+err.Error(), back.ErrorRead, true) + other.PrintError("Failed to get current device ID: "+err.Error(), back.ErrorRead) } _, _, err = synccycles.DeviceIDGen(oldDeviceID) if err != nil { - other.PrintError("Failed to change device ID: "+err.Error(), global.ErrorSyncProcess, true) + other.PrintError("Failed to change device ID: "+err.Error(), global.ErrorSyncProcess) } fmt.Println("\nDevice ID changed successfully.") case 2: @@ -218,7 +218,7 @@ func main() { fmt.Print("\nRe-encrypting entries. Please wait; do not force close this process.\n") err := core.EntryRefresh(oldPassphrase, newPassphrase, false) if err != nil { - other.PrintError("Re-encryption failed: "+err.Error(), global.ErrorEncryption, true) + other.PrintError("Re-encryption failed: "+err.Error(), global.ErrorEncryption) } fmt.Println("\nRe-encryption complete.") } diff --git a/src/cli/add.go b/src/cli/add.go index 3e3213b..edb500c 100644 --- a/src/cli/add.go +++ b/src/cli/add.go @@ -13,7 +13,7 @@ func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) { // ensure targetLocation is valid _, err := core.EntryAddPrecheck(targetLocation) if err != nil { - other.PrintError("Failed to add entry: "+err.Error(), back.ErrorWrite, true) + other.PrintError("Failed to add entry: "+err.Error(), back.ErrorWrite) } var decryptedEntry []string diff --git a/src/cli/edit.go b/src/cli/edit.go index 2e0e010..cb2f466 100644 --- a/src/cli/edit.go +++ b/src/cli/edit.go @@ -20,7 +20,7 @@ func RenameCli(oldLocationIncomplete string) { newLocationIncomplete := front.Input("New location:") err := syncclient.RenameRemoteFromClient(oldLocationIncomplete, newLocationIncomplete) if err != nil { - other.PrintError("Failed to rename entry: "+err.Error(), back.ErrorWrite, true) + other.PrintError("Failed to rename entry: "+err.Error(), back.ErrorWrite) } // exit is done from sync.RenameRemoteFromClient @@ -31,7 +31,7 @@ func EditEntryField(targetLocation string, hideSecrets bool, field int) { // fetch old entry data (with all required lines present) decryptedEntry, err := core.GetOldEntryData(targetLocation, field) if err != nil { - other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead, true) + other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead) } // edit the field @@ -52,7 +52,7 @@ func EditEntryField(targetLocation string, hideSecrets bool, field int) { // edit the note editedNote, noteEdited := editNote(fieldsNote) if !noteEdited { // exit early if the note was not edited - other.PrintError("Entry is unchanged", 0, true) + other.PrintError("Entry is unchanged", 0) } decryptedEntry = append(fieldsMain, editedNote...) } @@ -66,7 +66,7 @@ func GenUpdate(targetLocation string, hideSecrets bool) { // fetch old entry data decryptedEntry, err := core.GetOldEntryData(targetLocation, 0) if err != nil { - other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead, true) + other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead) } // generate a new password @@ -81,7 +81,7 @@ func GenUpdate(targetLocation string, hideSecrets bool) { func editNote(baseNote []string) ([]string, bool) { tempFile, err := back.CreateTempFile() if err != nil { - other.PrintError("Failed to create temporary note file: "+err.Error(), back.ErrorWrite, true) + other.PrintError("Failed to create temporary note file: "+err.Error(), back.ErrorWrite) } defer func(name string) { _ = os.Remove(name) // error ignored; if the file could be created, it can probably be removed diff --git a/src/cli/entryList.go b/src/cli/entryList.go index 7e841ed..3964710 100644 --- a/src/cli/entryList.go +++ b/src/cli/entryList.go @@ -82,7 +82,7 @@ func printFileEntry(entry string, lastSlash, charCounter, indent int, colorAlter func EntryListGen() { fileList, dirList, err := synccommon.WalkEntryDir() if err != nil { - other.PrintError("Failed to generate entry list: "+err.Error(), back.ErrorRead, true) + other.PrintError("Failed to generate entry list: "+err.Error(), back.ErrorRead) } // print header bar w/total entry count diff --git a/src/cli/entryReader.go b/src/cli/entryReader.go index 17ad456..11f150c 100644 --- a/src/cli/entryReader.go +++ b/src/cli/entryReader.go @@ -69,7 +69,7 @@ fieldLoop: if syncEnabled { _, err := syncclient.RunJob(false) if err != nil { - other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess, true) + other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess) } } @@ -80,11 +80,11 @@ fieldLoop: func EntryReaderDecrypt(targetLocation string, hideSecrets bool) { _, err := back.TargetIsFile(targetLocation, true) if err != nil { // if the location does not exist or is a directory... - other.PrintError("Failed to verify target location: "+err.Error(), back.ErrorTargetNotFound, true) + other.PrintError("Failed to verify target location: "+err.Error(), back.ErrorTargetNotFound) } decBytes, err := crypt.DecryptFileToSlice(targetLocation) if err != nil { - other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption, true) + other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption) } EntryReader(decBytes, hideSecrets, false) // never sync if decrypting straight to EntryReader, as this means the entry could not have been modified // do not exit, as this is the job of EntryReader diff --git a/src/cli/utilitiesMisc.go b/src/cli/utilitiesMisc.go index 54762d5..a95f950 100644 --- a/src/cli/utilitiesMisc.go +++ b/src/cli/utilitiesMisc.go @@ -34,12 +34,12 @@ func writeEntryCLI(targetLocation string, decryptedEntry []string, hideSecrets b // write the entry to the target location err := core.WriteEntry(targetLocation, []byte(strings.Join(decryptedEntry, "\n"))) if err != nil { - other.PrintError("Failed to write entry: "+err.Error(), back.ErrorWrite, true) + other.PrintError("Failed to write entry: "+err.Error(), back.ErrorWrite) } // preview the entry fmt.Println(back.AnsiBold + "\nEntry Preview:" + back.AnsiReset) EntryReader(decryptedEntry, hideSecrets, true) } else { - other.PrintError("No data supplied for entry", back.ErrorTargetNotFound, true) + other.PrintError("No data supplied for entry", back.ErrorTargetNotFound) } }