From 7d63867f365163f149db5d768c71f518f9eaf711 Mon Sep 17 00:00:00 2001 From: s Date: Fri, 7 Nov 2025 11:50:47 -0500 Subject: refactor: extract json output formatting to utils.PrintJSON and add colorized json output with new dns tld command --- cmd/osint.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'cmd/osint.go') diff --git a/cmd/osint.go b/cmd/osint.go index 49b94ab..5aa8799 100644 --- a/cmd/osint.go +++ b/cmd/osint.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/models" + "git.db.org.ai/dborg/internal/utils" "github.com/spf13/cobra" ) @@ -106,13 +107,7 @@ func runOsintBSSIDLookup(cmd *cobra.Command, args []string) error { return err } - output, err := json.MarshalIndent(response, "", " ") - if err != nil { - return fmt.Errorf("failed to format response: %w", err) - } - - fmt.Println(string(output)) - return nil + return utils.PrintJSON(response) } func runOsintBreachForumSearch(cmd *cobra.Command, args []string) error { @@ -134,11 +129,5 @@ func runOsintBreachForumSearch(cmd *cobra.Command, args []string) error { return err } - output, err := json.MarshalIndent(response, "", " ") - if err != nil { - return fmt.Errorf("failed to format response: %w", err) - } - - fmt.Println(string(output)) - return nil + return utils.PrintJSON(response) } -- cgit v1.2.3