refactor: replace explicit fields with tag-based property system
This commit is contained in:
14
cmd/inbox.go
14
cmd/inbox.go
@@ -3,23 +3,23 @@ package cmd
|
||||
import (
|
||||
"axolotl/db"
|
||||
"axolotl/output"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var inboxCmd = &cobra.Command{
|
||||
Use: "inbox",
|
||||
Short: "Show your inbox",
|
||||
Use: "inbox", Short: "Show your inbox",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
d, err := db.GetDB()
|
||||
user := db.GetCurrentUser()
|
||||
nodes, err := d.ListNodes(db.ListFilter{
|
||||
Inbox: user,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
return
|
||||
}
|
||||
output.PrintNodes(cmd.OutOrStdout(), nodes, jsonFlag)
|
||||
if nodes, err := d.ListNodes(db.ListFilter{TagPrefixes: []string{"_inbox::" + db.GetCurrentUser()}}); err == nil {
|
||||
output.PrintNodes(cmd.OutOrStdout(), nodes, jsonFlag)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user