summaryrefslogtreecommitdiffstats
path: root/cmd/admin.go
diff options
context:
space:
mode:
authors <[email protected]>2025-11-07 11:50:47 -0500
committers <[email protected]>2025-11-07 11:50:47 -0500
commit7d63867f365163f149db5d768c71f518f9eaf711 (patch)
treef3f4856cf82f57286dee5bec23fae0c5f70bd1ee /cmd/admin.go
parent5821aaa32e7ff2a2b2935bee712c2684907a3451 (diff)
downloaddborg-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/admin.go')
-rw-r--r--cmd/admin.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/cmd/admin.go b/cmd/admin.go
index 5637724..e0f0653 100644
--- a/cmd/admin.go
+++ b/cmd/admin.go
@@ -1,11 +1,11 @@
package cmd
import (
- "encoding/json"
"fmt"
"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"
"strconv"
"github.com/spf13/cobra"
@@ -94,13 +94,7 @@ func runAdminList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("API error: %s", response.Error)
}
- output, err := json.MarshalIndent(response.Accounts, "", " ")
- if err != nil {
- return fmt.Errorf("failed to format response: %w", err)
- }
-
- fmt.Println(string(output))
- return nil
+ return utils.PrintJSON(response.Accounts)
}
func runAdminCreate(cmd *cobra.Command, args []string) error {