mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 04:46:41 -04:00
Better document new blank option="password" shortcut, order arguments in order of expected use, list passwords first in entry reader
This commit is contained in:
+5
-11
@@ -16,19 +16,8 @@ func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) {
|
||||
var notesFlag bool
|
||||
|
||||
for i := range decryptedEntry {
|
||||
|
||||
// if the entry only contains a password, skip the username field to avoid an index out of range error
|
||||
if len(decryptedEntry) == 1 {
|
||||
i = 1
|
||||
}
|
||||
|
||||
switch i {
|
||||
case 0:
|
||||
// if the second field (username) is not empty, print it
|
||||
if decryptedEntry[1] != "" {
|
||||
fmt.Print(ansiDirectoryHeader + "Username:" + offline.AnsiReset + "\n" + decryptedEntry[1] + "\n\n")
|
||||
}
|
||||
case 1:
|
||||
// if the first field (password) is not empty, print it
|
||||
if decryptedEntry[0] != "" {
|
||||
if !hidePassword {
|
||||
@@ -37,6 +26,11 @@ func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) {
|
||||
fmt.Print(ansiDirectoryHeader + "Password:" + offline.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + offline.AnsiReset + "\n\n")
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
// if the second field (username) is not empty, print it
|
||||
if decryptedEntry[1] != "" {
|
||||
fmt.Print(ansiDirectoryHeader + "Username:" + offline.AnsiReset + "\n" + decryptedEntry[1] + "\n\n")
|
||||
}
|
||||
case 2:
|
||||
// if the third field (url) is not empty, print it
|
||||
if decryptedEntry[2] != "" {
|
||||
|
||||
Reference in New Issue
Block a user