diff options
| author | s <[email protected]> | 2025-11-07 11:50:47 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-07 11:50:47 -0500 |
| commit | 7d63867f365163f149db5d768c71f518f9eaf711 (patch) | |
| tree | f3f4856cf82f57286dee5bec23fae0c5f70bd1ee /cmd/x.go | |
| parent | 5821aaa32e7ff2a2b2935bee712c2684907a3451 (diff) | |
| download | dborg-7d63867f365163f149db5d768c71f518f9eaf711.tar.gz dborg-7d63867f365163f149db5d768c71f518f9eaf711.zip | |
refactor: extract json output formatting to utils.PrintJSON and add colorized json output with new dns tld command
Diffstat (limited to 'cmd/x.go')
| -rw-r--r-- | cmd/x.go | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -5,6 +5,7 @@ import ( "fmt" "git.db.org.ai/dborg/internal/client" "git.db.org.ai/dborg/internal/config" + "git.db.org.ai/dborg/internal/utils" "github.com/spf13/cobra" ) @@ -56,19 +57,11 @@ func runXHistorySearch(cmd *cobra.Command, args []string) error { } if len(response.PreviousUsernames) > 0 { - output, err := json.MarshalIndent(response.PreviousUsernames, "", " ") - if err != nil { - return fmt.Errorf("failed to format response: %w", err) - } - fmt.Println(string(output)) + return utils.PrintJSON(response.PreviousUsernames) } else if response.Response != "" { fmt.Println(response.Response) } else if response.Data != nil { - output, err := json.MarshalIndent(response.Data, "", " ") - if err != nil { - return fmt.Errorf("failed to format response: %w", err) - } - fmt.Println(string(output)) + return utils.PrintJSON(response.Data) } else { fmt.Println("No username history found") } |
