Skip to content

Commit 6eee322

Browse files
author
Anand
committed
fixed bugs issue #32 #33 #34 - added migrate option and tag as a regular field - issues #30 #31
1 parent 9078745 commit 6eee322

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

utils.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,22 @@ func rewriteBaseFile(path string, contents []byte, mode fs.FileMode) (error, str
213213
return err, origFile
214214
}
215215

216+
// Rewrite the contents of the file with the new contents
217+
func rewriteFile(path string, contents []byte, mode fs.FileMode) (error, string) {
218+
219+
var err error
220+
221+
// Overwrite it
222+
err = os.WriteFile(path, contents, 0644)
223+
224+
if err == nil {
225+
// Chmod it
226+
os.Chmod(path, mode)
227+
}
228+
229+
return err, path
230+
}
231+
216232
// Get color codes for console colors
217233
func getColor(code string) string {
218234

@@ -317,7 +333,13 @@ func printEntry(entry *Entry, delim bool) error {
317333
}
318334
fmt.Printf("Password: %s\n", strings.Join(asterisks, ""))
319335
}
320-
fmt.Printf("Notes: %s\n", entry.Notes)
336+
337+
if len(entry.Tags) > 0 {
338+
fmt.Printf("Tags: %s\n", entry.Tags)
339+
}
340+
if len(entry.Notes) > 0 {
341+
fmt.Printf("Notes: %s\n", entry.Notes)
342+
}
321343
// Query extended entries
322344
customEntries = getExtendedEntries(entry)
323345

0 commit comments

Comments
 (0)