- Abstract property flags into addPropertyFlags in cmd/root.go and apply to commands - Remove unused GetUserByUsername from db.go (it's redundant with service.resolveUserIDByName) - Use configured user in WithMentions directly in inbox command - Refactor resolve methods in node_service_sqlite.go to reduce duplication
31 lines
575 B
Go
31 lines
575 B
Go
package cmd
|
|
|
|
import (
|
|
"axolotl/db"
|
|
"axolotl/output"
|
|
"axolotl/service"
|
|
"fmt"
|
|
"os"
|
|
|
|
"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()
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
return
|
|
}
|
|
svc := service.NewSQLiteNodeService(d.DB, cfg.GetUser())
|
|
if nodes, err := svc.List(service.WithMentions(cfg.GetUser())); err == nil {
|
|
output.PrintNodes(cmd.OutOrStdout(), nodes, jsonFlag)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(inboxCmd)
|
|
}
|