Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix(cli): incorrect return type for settings reponse
Kyle Mendelle3c323b2c59b
diff --git a/cli/pkg/settings/cmd.go b/cli/pkg/settings/cmd.goindex 6d9423a10..1350ec534 100644--- a/cli/pkg/settings/cmd.go+++ b/cli/pkg/settings/cmd.go@@ -7,7 +7,6 @@ import ("github.com/getarcaneapp/arcane/cli/internal/client""github.com/getarcaneapp/arcane/cli/internal/output""github.com/getarcaneapp/arcane/cli/internal/types"- "github.com/getarcaneapp/arcane/types/base""github.com/getarcaneapp/arcane/types/category""github.com/getarcaneapp/arcane/types/search""github.com/getarcaneapp/arcane/types/settings"@@ -39,13 +38,13 @@ var getCmd = &cobra.Command{}defer func() { _ = resp.Body.Close() }()- var result base.ApiResponse[[]settings.SettingDto]+ var result []settings.PublicSettingif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {return fmt.Errorf("failed to parse response: %w", err)}if jsonOutput {- resultBytes, err := json.MarshalIndent(result.Data, "", " ")+ resultBytes, err := json.MarshalIndent(result, "", " ")if err != nil {return fmt.Errorf("failed to marshal JSON: %w", err)}@@ -53,19 +52,18 @@ var getCmd = &cobra.Command{return nil}- headers := []string{"KEY", "TYPE", "VALUE", "PUBLIC"}- rows := make([][]string, len(result.Data))- for i, s := range result.Data {+ headers := []string{"KEY", "TYPE", "VALUE"}+ rows := make([][]string, len(result))+ for i, s := range result {rows[i] = []string{s.Key,s.Type,s.Value,- fmt.Sprintf("%t", s.IsPublic),}}output.Table(headers, rows)- fmt.Printf("\nTotal: %d settings\n", len(result.Data))+ fmt.Printf("\nTotal: %d settings\n", len(result))return nil},}@@ -86,13 +84,13 @@ var categoriesCmd = &cobra.Command{}defer func() { _ = resp.Body.Close() }()- var result base.ApiResponse[[]category.Category]+ var result []category.Categoryif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {return fmt.Errorf("failed to parse response: %w", err)}if jsonOutput {- resultBytes, err := json.MarshalIndent(result.Data, "", " ")+ resultBytes, err := json.MarshalIndent(result, "", " ")if err != nil {return fmt.Errorf("failed to marshal JSON: %w", err)}@@ -101,8 +99,8 @@ var categoriesCmd = &cobra.Command{}headers := []string{"ID", "TITLE", "DESCRIPTION"}- rows := make([][]string, len(result.Data))- for i, cat := range result.Data {+ rows := make([][]string, len(result))+ for i, cat := range result {rows[i] = []string{cat.ID,cat.Title,@@ -111,7 +109,7 @@ var categoriesCmd = &cobra.Command{}output.Table(headers, rows)- fmt.Printf("\nTotal: %d categories\n", len(result.Data))+ fmt.Printf("\nTotal: %d categories\n", len(result))return nil},}@@ -138,13 +136,13 @@ var searchCmd = &cobra.Command{}defer func() { _ = resp.Body.Close() }()- var result base.ApiResponse[search.Response]+ var result search.Responseif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {return fmt.Errorf("failed to parse response: %w", err)}if jsonOutput {- resultBytes, err := json.MarshalIndent(result.Data, "", " ")+ resultBytes, err := json.MarshalIndent(result, "", " ")if err != nil {return fmt.Errorf("failed to marshal JSON: %w", err)}@@ -153,10 +151,10 @@ var searchCmd = &cobra.Command{}output.Header("Search Results")- fmt.Printf("Query: %s\n", result.Data.Query)- fmt.Printf("Found: %d results\n\n", result.Data.Count)+ fmt.Printf("Query: %s\n", result.Query)+ fmt.Printf("Found: %d results\n\n", result.Count)- for _, cat := range result.Data.Results {+ for _, cat := range result.Results {output.KeyValue(cat.Title, cat.Description)}