Re-write argument parsing, implement skeleton of copy functionality

This commit is contained in:
2024-03-01 21:09:56 -05:00
parent 0afcdbb29b
commit 51313eb307
5 changed files with 145 additions and 32 deletions
+11
View File
@@ -3,9 +3,11 @@ package cli
import (
"fmt"
"github.com/rwinkhart/MUTN/src/offline"
"os"
)
// EntryReader prints the decrypted contents of a libmutton entry in a human-readable format
// TODO implement password hiding
func EntryReader(decryptedEntry []string) {
fmt.Println()
@@ -54,4 +56,13 @@ func EntryReader(decryptedEntry []string) {
if notesFlag {
fmt.Println()
}
os.Exit(0)
}
func EntryReaderShortcut(targetLocation string) {
if isFile, _ := offline.TargetIsFile(targetLocation, true); isFile {
EntryReader(offline.DecryptGPG(targetLocation))
} else {
fmt.Println(offline.AnsiError + "Failed to read \"" + targetLocation + "\" - it is a directory" + offline.AnsiReset)
}
}