Fail early if adding an entry to a directory that does not exist (or if the directory is a file)

This commit is contained in:
2024-07-19 15:53:54 -04:00
parent 9077501d66
commit d659291a2f
3 changed files with 10 additions and 5 deletions
+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 bool) {
func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets, verifyEntryDoesNotExist bool) {
if backend.EntryIsNotEmpty(unencryptedEntry) {
// write the entry to the target location
backend.WriteEntry(targetLocation, unencryptedEntry)
backend.WriteEntry(targetLocation, unencryptedEntry, verifyEntryDoesNotExist)
// preview the entry
fmt.Println(AnsiBold + "\nEntry Preview:" + backend.AnsiReset)
EntryReader(unencryptedEntry, hideSecrets, true)