From 8a342848809a26e7e13933180b4df91d4a52f898 Mon Sep 17 00:00:00 2001 From: s Date: Tue, 25 Nov 2025 09:58:42 -0500 Subject: feat: add dns site check, services list, and additional twitter/x api endpoints --- cmd/services.go | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 cmd/services.go (limited to 'cmd/services.go') diff --git a/cmd/services.go b/cmd/services.go new file mode 100644 index 0000000..56c2149 --- /dev/null +++ b/cmd/services.go @@ -0,0 +1,49 @@ +package cmd + +import ( + "encoding/json" + "fmt" + + "github.com/spf13/cobra" +) + +var servicesCmd = &cobra.Command{ + Use: "services", + Short: "List all available services and pricing", + Long: `Get a list of all available services and their credit costs`, + RunE: runServices, +} + +func init() { + rootCmd.AddCommand(servicesCmd) +} + +func runServices(cmd *cobra.Command, args []string) error { + c, err := newUnauthenticatedClient() + if err != nil { + return err + } + + data, err := c.ListServices() + if err != nil { + return err + } + + if IsJSONOutput() { + fmt.Println(string(data)) + return nil + } + + var services map[string]interface{} + if err := json.Unmarshal(data, &services); err != nil { + return fmt.Errorf("failed to parse services: %w", err) + } + + fmt.Println("\nAvailable Services:") + fmt.Println("===================\n") + + servicesData, _ := json.MarshalIndent(services, "", " ") + fmt.Println(string(servicesData)) + + return nil +} -- cgit v1.2.3