29 lines
465 B
Go
29 lines
465 B
Go
|
|
package cmd
|
||
|
|
|
||
|
|
import (
|
||
|
|
"axolotl/db"
|
||
|
|
"axolotl/output"
|
||
|
|
|
||
|
|
"github.com/spf13/cobra"
|
||
|
|
)
|
||
|
|
|
||
|
|
var inboxCmd = &cobra.Command{
|
||
|
|
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 {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
output.PrintNodes(cmd.OutOrStdout(), nodes, jsonFlag)
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
func init() {
|
||
|
|
rootCmd.AddCommand(inboxCmd)
|
||
|
|
}
|