refactor: simplify db and cmd flags, reduce code duplication
- 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
This commit is contained in:
11
cmd/inbox.go
11
cmd/inbox.go
@@ -18,17 +18,8 @@ var inboxCmd = &cobra.Command{
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
return
|
||||
}
|
||||
userID, err := d.GetUserByUsername(cfg.GetUser())
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
return
|
||||
}
|
||||
if userID == "" {
|
||||
output.PrintNodes(cmd.OutOrStdout(), nil, jsonFlag)
|
||||
return
|
||||
}
|
||||
svc := service.NewSQLiteNodeService(d.DB, cfg.GetUser())
|
||||
if nodes, err := svc.List(service.WithMentions(userID)); err == nil {
|
||||
if nodes, err := svc.List(service.WithMentions(cfg.GetUser())); err == nil {
|
||||
output.PrintNodes(cmd.OutOrStdout(), nodes, jsonFlag)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user