Rename "backend" package to "core"

This commit is contained in:
2024-08-08 16:49:34 -04:00
parent ba4f7f2340
commit c83a3aa018
25 changed files with 109 additions and 107 deletions
+25
View File
@@ -0,0 +1,25 @@
package core
// GetOldEntryData decrypts and returns old entry data (with all required lines present)
func GetOldEntryData(targetLocation string, field int) []string {
// ensure targetLocation exists
TargetIsFile(targetLocation, true, 2)
// read old entry data
unencryptedEntry := DecryptGPG(targetLocation)
// return the old entry data with all required lines present
if field > 0 {
return EnsureSliceLength(unencryptedEntry, field)
} else {
return unencryptedEntry
}
}
// EnsureSliceLength ensures slice is long enough to contain the specified index
func EnsureSliceLength(slice []string, index int) []string {
for len(slice) <= index {
slice = append(slice, "")
}
return slice
}