mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-02 23:27:22 -04:00
Implement initial entry adding (partial, missing notes support)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// AddFolder creates a new directory at targetLocation
|
||||
func AddFolder(targetLocation string) {
|
||||
// create the directory specified by targetLocation
|
||||
err := os.Mkdir(targetLocation, 0700)
|
||||
@@ -20,3 +21,13 @@ 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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user