-
Notifications
You must be signed in to change notification settings - Fork 4
/
info.go
28 lines (21 loc) · 799 Bytes
/
info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main
import (
"fmt"
"strings"
"github.com/spf13/cobra"
)
func infoCmd(_ *cobra.Command, args []string) error {
entry, err := readEntry(strings.Join(args, " "), &db.Content.Root.Groups[0])
if err != nil {
return err
}
fmt.Printf("Title: %s\n", entry.GetTitle())
fmt.Printf("Creation: %s\n", entry.Times.CreationTime.Time.Format(timeFormat))
fmt.Printf("Last Modification: %s\n", entry.Times.LastModificationTime.Time.Format(timeFormat))
fmt.Printf("Last Access: %s\n", entry.Times.LastAccessTime.Time.Format(timeFormat))
fmt.Printf("UserName: %s\n", entry.GetContent("UserName"))
fmt.Printf("URL: %s\n", entry.GetContent("URL"))
fmt.Printf("Notes:\n%s\n", entry.GetContent("Notes"))
markAsAccessed(entry)
return nil
}