Bump libmutton/go-boilerplate

This commit is contained in:
2025-06-01 17:04:27 -04:00
parent 9201e3857c
commit bdaaf0906c
8 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -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
+5 -5
View File
@@ -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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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)
}
}