summaryrefslogtreecommitdiffstats
path: root/cmd/dns.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dns.go')
-rw-r--r--cmd/dns.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/dns.go b/cmd/dns.go
index d6776ee..130f394 100644
--- a/cmd/dns.go
+++ b/cmd/dns.go
@@ -6,6 +6,7 @@ import (
"git.db.org.ai/dborg/internal/client"
"git.db.org.ai/dborg/internal/config"
+ "git.db.org.ai/dborg/internal/formatter"
"git.db.org.ai/dborg/internal/models"
"github.com/spf13/cobra"
)
@@ -42,7 +43,16 @@ func runDNSTLDCheck(cmd *cobra.Command, args []string) error {
fmt.Printf("Checking TLDs for term: %s\n\n", term)
err = c.CheckDNSTLDStream(params, func(result json.RawMessage) error {
- fmt.Println(string(result))
+ var domainResult models.DomainResult
+ if err := json.Unmarshal(result, &domainResult); err != nil {
+ return fmt.Errorf("failed to parse result: %w", err)
+ }
+
+ output, err := formatter.FormatDNSResults(&domainResult, IsJSONOutput())
+ if err != nil {
+ return err
+ }
+ fmt.Print(output)
return nil
})