Do not check if an entry already exists when writing (add); an earlier check is already performed

This commit is contained in:
2025-01-18 19:33:54 -05:00
parent 38ddc32656
commit dd8464ecd9
5 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ go 1.23.4
require (
github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514
github.com/charmbracelet/glamour v0.7.0
github.com/rwinkhart/libmutton v0.2.5-0.20250116205734-55be8a30759e
github.com/rwinkhart/libmutton v0.2.5-0.20250119002915-fb5449cf1f75
golang.org/x/term v0.28.0
)
+2 -2
View File
@@ -58,8 +58,8 @@ 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/libmutton v0.2.5-0.20250116205734-55be8a30759e h1:Mov+GEUtCXbrtpNzRCWaxdWhnmxYXa1IHXYMnkkXFdQ=
github.com/rwinkhart/libmutton v0.2.5-0.20250116205734-55be8a30759e/go.mod h1:kn7x0901qFyX1/HBxJf287zoySZkxKRMObKigLiI5Ok=
github.com/rwinkhart/libmutton v0.2.5-0.20250119002915-fb5449cf1f75 h1:vHUCzYT1ZWxaEGfF3Xhx2v2x/IQcmLqSp+46dgW4KPg=
github.com/rwinkhart/libmutton v0.2.5-0.20250119002915-fb5449cf1f75/go.mod h1:kn7x0901qFyX1/HBxJf287zoySZkxKRMObKigLiI5Ok=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+1 -1
View File
@@ -48,5 +48,5 @@ func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) {
}
// write and preview the new entry
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets, false)
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets)
}
+2 -2
View File
@@ -51,7 +51,7 @@ func EditEntryField(targetLocation string, hideSecrets bool, field int) {
}
// write and preview the modified entry
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets, false)
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets)
}
// GenUpdate generates a new password for an entry at targetLocation (user input).
@@ -63,7 +63,7 @@ func GenUpdate(targetLocation string, hideSecrets bool) {
unencryptedEntry[0] = core.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2, false)
// write and preview the modified entry
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets, false)
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets)
}
// editNote uses the user-specified text editor to edit an existing note (or create a new one if baseNote is empty).
+2 -2
View File
@@ -65,10 +65,10 @@ func inputMenuGen(prompt string, options []string) int {
}
// writeEntryCLI writes an entry to targetLocation and previews it (errors if no data is supplied).
func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets, verifyEntryDoesNotExist bool) {
func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets bool) {
if core.EntryIsNotEmpty(unencryptedEntry) {
// write the entry to the target location
core.WriteEntry(targetLocation, unencryptedEntry, verifyEntryDoesNotExist)
core.WriteEntry(targetLocation, unencryptedEntry)
// preview the entry
fmt.Println(AnsiBold + "\nEntry Preview:" + core.AnsiReset)
EntryReader(unencryptedEntry, hideSecrets, true)