diff --git a/cmd/ek/main.go b/cmd/ek/main.go index 1c430c7..e86cc9d 100644 --- a/cmd/ek/main.go +++ b/cmd/ek/main.go @@ -138,6 +138,7 @@ Commands: timeline UID -before BEFORE show posts for channel UID ending at BEFORE search QUERY search for feeds from QUERY + query QUERY CHANNEL search for items matching QUERY in CHANNEL preview URL show items from the feed at URL @@ -299,6 +300,24 @@ func performCommands(sub microsub.Microsub, commands []string) { } } + if len(commands) >= 2 && len(commands) <= 3 && commands[0] == "query" { + query := commands[1] + var channel string + if len(commands) == 3 { + channel = commands[2] + } else { + channel = "global" + } + items, err := sub.ItemSearch(channel, query) + if err != nil { + log.Fatalf("An error occurred: %s\n", err) + } + + for _, item := range items { + showItem(&item) + } + } + if len(commands) == 2 && commands[0] == "preview" { u := commands[1] timeline, err := sub.PreviewURL(u)