summaryrefslogtreecommitdiffstats
path: root/cmd/breachforum.go
diff options
context:
space:
mode:
authorsinner <[email protected]>2026-04-15 15:16:02 -0400
committersinner <[email protected]>2026-04-15 15:16:02 -0400
commita5f907854f29e1c267ad30d1dfe85c2c47f5ac48 (patch)
treebc8685c3b22e6d5d47702ba0607c694f938ba7fd /cmd/breachforum.go
parent8a1cf20dd5014ebe15ced77344902b79dcfa2e66 (diff)
downloaddborg-1.1.1.tar.gz
dborg-1.1.1.zip
feat: add stdin support and retry logic for all search commandsHEADv1.1.1v0.1.14master
Diffstat (limited to 'cmd/breachforum.go')
-rw-r--r--cmd/breachforum.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/cmd/breachforum.go b/cmd/breachforum.go
index 63254c1..229292a 100644
--- a/cmd/breachforum.go
+++ b/cmd/breachforum.go
@@ -11,7 +11,7 @@ var breachforumCmd = &cobra.Command{
Aliases: []string{"brf"},
Short: "Search BreachForum data",
Long: `Search breachdetect index for BreachForum messages and detections`,
- Args: cobra.ExactArgs(1),
+ Args: argsOrStdin(1),
RunE: runBreachForumSearch,
}
@@ -26,15 +26,17 @@ func runBreachForumSearch(cmd *cobra.Command, args []string) error {
return err
}
- params := &models.BreachForumSearchParams{
- Search: args[0],
- }
- params.MaxHits, _ = cmd.Flags().GetInt("max_hits")
-
- response, err := c.SearchBreachForum(params)
- if err != nil {
- return err
- }
+ maxHits, _ := cmd.Flags().GetInt("max_hits")
- return formatter.FormatBreachForumResults(response, IsJSONOutput())
+ return forEachQuery(args, func(query string) error {
+ params := &models.BreachForumSearchParams{
+ Search: query,
+ MaxHits: maxHits,
+ }
+ response, err := c.SearchBreachForum(params)
+ if err != nil {
+ return err
+ }
+ return formatter.FormatBreachForumResults(response, IsJSONOutput())
+ })
}