refactor: convert inbox command to default alias

This commit is contained in:
2026-03-29 19:56:15 +02:00
parent 535626d198
commit 6ff013dd2a
4 changed files with 18 additions and 37 deletions

View File

@@ -12,6 +12,7 @@ import (
var lAssignee string
var lTags []string
var lMention string
var listCmd = &cobra.Command{
Use: "list", Short: "List nodes",
@@ -22,7 +23,18 @@ var listCmd = &cobra.Command{
return
}
svc := service.NewSQLiteNodeService(d.DB, cfg.GetUser())
if nodes, err := svc.List(service.WithTags(lTags...), service.WithAssignee(lAssignee)); err == nil {
opts := []service.ListOption{}
if len(lTags) > 0 {
opts = append(opts, service.WithTags(lTags...))
}
if lAssignee != "" {
opts = append(opts, service.WithAssignee(lAssignee))
}
if lMention != "" {
opts = append(opts, service.WithMentions(lMention))
}
if nodes, err := svc.List(opts...); err == nil {
output.PrintNodes(cmd.OutOrStdout(), nodes, jsonFlag)
} else {
fmt.Fprintf(os.Stderr, "err: %v\n", err)
@@ -36,4 +48,5 @@ func init() {
f := listCmd.Flags()
f.StringVar(&lAssignee, "assignee", "", "")
f.StringArrayVar(&lTags, "tag", nil, "")
f.StringVar(&lMention, "mention", "", "")
}