Implement note editing

This commit is contained in:
2024-03-07 20:15:01 -05:00
parent 3a90bef48a
commit 22758460ab
7 changed files with 141 additions and 84 deletions
-10
View File
@@ -21,13 +21,3 @@ func AddFolder(targetLocation string) {
// TODO If in online mode, create the directory on the server
os.Exit(0)
}
// WriteEntry writes entryData to an encrypted file at targetLocation
func WriteEntry(targetLocation string, entryData []string) {
encryptedBytes := EncryptGPG(entryData)
err := os.WriteFile(targetLocation, encryptedBytes, 0600)
if err != nil {
fmt.Println(AnsiError + "Failed to write to file: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
+10
View File
@@ -39,6 +39,16 @@ func TargetIsFile(targetLocation string, errorOnFail bool, failCondition uint8)
}
}
// WriteEntry writes entryData to an encrypted file at targetLocation
func WriteEntry(targetLocation string, entryData []string) {
encryptedBytes := EncryptGPG(entryData)
err := os.WriteFile(targetLocation, encryptedBytes, 0600)
if err != nil {
fmt.Println(AnsiError + "Failed to write to file: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
// writeToStdin writes a string to a command's stdin
func writeToStdin(cmd *exec.Cmd, input string) {
stdin, _ := cmd.StdinPipe()