diff --git a/internal/cmd/config/unset/unset.go b/internal/cmd/config/unset/unset.go index 3bd678b5..501635b8 100644 --- a/internal/cmd/config/unset/unset.go +++ b/internal/cmd/config/unset/unset.go @@ -40,7 +40,7 @@ func NewCmd() *cobra.Command { viper.Set(config.ProjectIdKey, "") } if model.OutputFormat { - viper.Set(config.OutputFormatKey, "default") + viper.Set(config.OutputFormatKey, "") } if model.DNSCustomEndpoint { viper.Set(config.DNSCustomEndpointKey, "") @@ -48,7 +48,7 @@ func NewCmd() *cobra.Command { if model.PostgreSQLCustomEndpoint { viper.Set(config.PostgreSQLCustomEndpointKey, "") } - if model.PostgreSQLCustomEndpoint { + if model.SKECustomEndpoint { viper.Set(config.SKECustomEndpointKey, "") } diff --git a/internal/cmd/dns/record-set/describe/describe.go b/internal/cmd/dns/record-set/describe/describe.go index 4d4e6f07..b2cea8de 100644 --- a/internal/cmd/dns/record-set/describe/describe.go +++ b/internal/cmd/dns/record-set/describe/describe.go @@ -8,6 +8,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/flags" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" "github.com/spf13/cobra" @@ -50,16 +51,9 @@ func NewCmd() *cobra.Command { if err != nil { return fmt.Errorf("read DNS record set: %w", err) } - recordSet := *resp.Rrset + recordSet := resp.Rrset - // Show details - details, err := json.MarshalIndent(recordSet, "", " ") - if err != nil { - return fmt.Errorf("marshal DNS record set: %w", err) - } - cmd.Println(string(details)) - - return nil + return outputResult(cmd, model.OutputFormat, recordSet) }, } configureFlags(cmd) @@ -91,3 +85,26 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *dns.APIClien req := apiClient.GetRecordSet(ctx, model.ProjectId, model.ZoneId, model.RecordSetId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, recordSet *dns.RecordSet) error { + switch outputFormat { + case globalflags.TableOutputFormat: + table := tables.NewTable() + table.SetHeader("ID", "Name", "Type", "State") + table.AddRow(*recordSet.Id, *recordSet.Name, *recordSet.Type, *recordSet.State) + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + default: + details, err := json.MarshalIndent(recordSet, "", " ") + if err != nil { + return fmt.Errorf("marshal DNS record set: %w", err) + } + cmd.Println(string(details)) + + return nil + } +} diff --git a/internal/cmd/dns/record-set/list/list.go b/internal/cmd/dns/record-set/list/list.go index b3c6c0e4..a46cfd50 100644 --- a/internal/cmd/dns/record-set/list/list.go +++ b/internal/cmd/dns/record-set/list/list.go @@ -2,6 +2,7 @@ package list import ( "context" + "encoding/json" "fmt" "strings" @@ -62,20 +63,7 @@ func NewCmd() *cobra.Command { cmd.Printf("No record sets found for zone %s in project with ID %s\n", model.ZoneId, model.ProjectId) return nil } - - // Show output as table - table := tables.NewTable() - table.SetHeader("ID", "Name", "Type", "State") - for i := range recordSets { - rs := recordSets[i] - table.AddRow(*rs.Id, *rs.Name, *rs.Type, *rs.State) - } - err = table.Render(cmd) - if err != nil { - return fmt.Errorf("render table: %w", err) - } - - return nil + return outputResult(cmd, model.OutputFormat, recordSets) }, } @@ -179,3 +167,29 @@ func fetchRecordSets(ctx context.Context, model *flagModel, apiClient dnsClient) } return recordSets, nil } + +func outputResult(cmd *cobra.Command, outputFormat string, recordSets []dns.RecordSet) error { + switch outputFormat { + case globalflags.JSONOutputFormat: + details, err := json.MarshalIndent(recordSets, "", " ") + if err != nil { + return fmt.Errorf("marshal DNS record set list: %w", err) + } + cmd.Println(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("ID", "Name", "Type", "State") + for i := range recordSets { + rs := recordSets[i] + table.AddRow(*rs.Id, *rs.Name, *rs.Type, *rs.State) + } + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/dns/zone/describe/describe.go b/internal/cmd/dns/zone/describe/describe.go index 0f758db3..82a4ad58 100644 --- a/internal/cmd/dns/zone/describe/describe.go +++ b/internal/cmd/dns/zone/describe/describe.go @@ -8,6 +8,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/flags" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" "github.com/spf13/cobra" @@ -47,16 +48,9 @@ func NewCmd() *cobra.Command { if err != nil { return fmt.Errorf("read DNS zone: %w", err) } - zone := *resp.Zone + zone := resp.Zone - // Show details - details, err := json.MarshalIndent(zone, "", " ") - if err != nil { - return fmt.Errorf("marshal DNS zone: %w", err) - } - cmd.Println(string(details)) - - return nil + return outputResult(cmd, model.OutputFormat, zone) }, } configureFlags(cmd) @@ -86,3 +80,26 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *dns.APIClien req := apiClient.GetZone(ctx, model.ProjectId, model.ZoneId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, zone *dns.Zone) error { + switch outputFormat { + case globalflags.TableOutputFormat: + table := tables.NewTable() + table.SetHeader("ID", "NAME", "DNS_NAME", "STATE") + table.AddRow(*zone.Id, *zone.Name, *zone.DnsName, *zone.State) + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + default: + details, err := json.MarshalIndent(zone, "", " ") + if err != nil { + return fmt.Errorf("marshal DNS zone: %w", err) + } + cmd.Println(string(details)) + + return nil + } +} diff --git a/internal/cmd/dns/zone/list/list.go b/internal/cmd/dns/zone/list/list.go index fc34a5e0..492cad9c 100644 --- a/internal/cmd/dns/zone/list/list.go +++ b/internal/cmd/dns/zone/list/list.go @@ -2,6 +2,7 @@ package list import ( "context" + "encoding/json" "fmt" "strings" @@ -61,19 +62,7 @@ func NewCmd() *cobra.Command { return nil } - // Show output as table - table := tables.NewTable() - table.SetHeader("ID", "NAME", "DNS_NAME", "STATE") - for i := range zones { - z := zones[i] - table.AddRow(*z.Id, *z.Name, *z.DnsName, *z.State) - } - err = table.Render(cmd) - if err != nil { - return fmt.Errorf("render table: %w", err) - } - - return nil + return outputResult(cmd, model.OutputFormat, zones) }, } configureFlags(cmd) @@ -171,3 +160,30 @@ func fetchZones(ctx context.Context, model *flagModel, apiClient dnsClient) ([]d } return zones, nil } + +func outputResult(cmd *cobra.Command, outputFormat string, zones []dns.Zone) error { + switch outputFormat { + case globalflags.JSONOutputFormat: + // Show details + details, err := json.MarshalIndent(zones, "", " ") + if err != nil { + return fmt.Errorf("marshal DNS zone list: %w", err) + } + cmd.Println(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("ID", "NAME", "DNS_NAME", "STATE") + for i := range zones { + z := zones[i] + table.AddRow(*z.Id, *z.Name, *z.DnsName, *z.State) + } + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/postgresql/credential/describe/describe.go b/internal/cmd/postgresql/credential/describe/describe.go index 2f852a74..b5c34fc6 100644 --- a/internal/cmd/postgresql/credential/describe/describe.go +++ b/internal/cmd/postgresql/credential/describe/describe.go @@ -8,6 +8,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/flags" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/services/postgresql/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" "github.com/spf13/cobra" @@ -51,14 +52,7 @@ func NewCmd() *cobra.Command { return fmt.Errorf("describe PostgreSQL credential: %w", err) } - // Show details - details, err := json.MarshalIndent(resp, "", " ") - if err != nil { - return fmt.Errorf("marshal PostgreSQL credential: %w", err) - } - cmd.Println(string(details)) - - return nil + return outputResult(cmd, model.OutputFormat, resp) }, } configureFlags(cmd) @@ -92,3 +86,26 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *postgresql.A req := apiClient.GetCredentials(ctx, model.ProjectId, model.InstanceId, model.CredentialId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, credential *postgresql.CredentialsResponse) error { + switch outputFormat { + case globalflags.TableOutputFormat: + table := tables.NewTable() + table.SetHeader("ID") + table.AddRow(*credential.Id) + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + default: + details, err := json.MarshalIndent(credential, "", " ") + if err != nil { + return fmt.Errorf("marshal PostgreSQL credential: %w", err) + } + cmd.Println(string(details)) + + return nil + } +} diff --git a/internal/cmd/postgresql/credential/list/list.go b/internal/cmd/postgresql/credential/list/list.go index 4dc355eb..cc0f176f 100644 --- a/internal/cmd/postgresql/credential/list/list.go +++ b/internal/cmd/postgresql/credential/list/list.go @@ -2,6 +2,7 @@ package list import ( "context" + "encoding/json" "fmt" "github.com/stackitcloud/stackit-cli/internal/pkg/flags" @@ -60,20 +61,7 @@ func NewCmd() *cobra.Command { if model.Limit != nil && len(credentials) > int(*model.Limit) { credentials = credentials[:*model.Limit] } - - // Show output as table - table := tables.NewTable() - table.SetHeader("ID") - for i := range credentials { - c := credentials[i] - table.AddRow(*c.Id) - } - err = table.Render(cmd) - if err != nil { - return fmt.Errorf("render table: %w", err) - } - - return nil + return outputResult(cmd, model.OutputFormat, credentials) }, } configureFlags(cmd) @@ -110,3 +98,29 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *postgresql.A req := apiClient.GetCredentialsIds(ctx, model.ProjectId, model.InstanceId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, credentials []postgresql.CredentialsListItem) error { + switch outputFormat { + case globalflags.JSONOutputFormat: + details, err := json.MarshalIndent(credentials, "", " ") + if err != nil { + return fmt.Errorf("marshal PostgreSQL credential list: %w", err) + } + cmd.Println(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("ID") + for i := range credentials { + c := credentials[i] + table.AddRow(*c.Id) + } + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/postgresql/instance/describe/describe.go b/internal/cmd/postgresql/instance/describe/describe.go index fa8f3bfd..14919d6f 100644 --- a/internal/cmd/postgresql/instance/describe/describe.go +++ b/internal/cmd/postgresql/instance/describe/describe.go @@ -8,6 +8,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/flags" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/services/postgresql/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" "github.com/spf13/cobra" @@ -48,14 +49,7 @@ func NewCmd() *cobra.Command { return fmt.Errorf("read PostgreSQL instance: %w", err) } - // Show details - details, err := json.MarshalIndent(resp, "", " ") - if err != nil { - return fmt.Errorf("marshal PostgreSQL instance: %w", err) - } - cmd.Println(string(details)) - - return nil + return outputResult(cmd, model.OutputFormat, resp) }, } configureFlags(cmd) @@ -85,3 +79,26 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *postgresql.A req := apiClient.GetInstance(ctx, model.ProjectId, model.InstanceId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, instance *postgresql.Instance) error { + switch outputFormat { + case globalflags.TableOutputFormat: + table := tables.NewTable() + table.SetHeader("ID", "NAME", "LAST_OPERATION.TYPE", "LAST_OPERATION.STATE") + table.AddRow(*instance.InstanceId, *instance.Name, *instance.LastOperation.Type, *instance.LastOperation.State) + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + default: + details, err := json.MarshalIndent(instance, "", " ") + if err != nil { + return fmt.Errorf("marshal PostgreSQL instance: %w", err) + } + cmd.Println(string(details)) + + return nil + } +} diff --git a/internal/cmd/postgresql/instance/list/list.go b/internal/cmd/postgresql/instance/list/list.go index ff6f4555..485b8562 100644 --- a/internal/cmd/postgresql/instance/list/list.go +++ b/internal/cmd/postgresql/instance/list/list.go @@ -2,6 +2,7 @@ package list import ( "context" + "encoding/json" "fmt" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" @@ -58,19 +59,7 @@ func NewCmd() *cobra.Command { instances = instances[:*model.Limit] } - // Show output as table - table := tables.NewTable() - table.SetHeader("ID", "NAME", "LAST_OPERATION.TYPE", "LAST_OPERATION.STATE") - for i := range instances { - instance := instances[i] - table.AddRow(*instance.InstanceId, *instance.Name, *instance.LastOperation.Type, *instance.LastOperation.State) - } - err = table.Render(cmd) - if err != nil { - return fmt.Errorf("render table: %w", err) - } - - return nil + return outputResult(cmd, model.OutputFormat, instances) }, } @@ -103,3 +92,29 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *postgresql.A req := apiClient.GetInstances(ctx, model.ProjectId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, instances []postgresql.Instance) error { + switch outputFormat { + case globalflags.JSONOutputFormat: + details, err := json.MarshalIndent(instances, "", " ") + if err != nil { + return fmt.Errorf("marshal PostgreSQL instance list: %w", err) + } + cmd.Println(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("ID", "NAME", "LAST_OPERATION.TYPE", "LAST_OPERATION.STATE") + for i := range instances { + instance := instances[i] + table.AddRow(*instance.InstanceId, *instance.Name, *instance.LastOperation.Type, *instance.LastOperation.State) + } + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/postgresql/offering/list/list.go b/internal/cmd/postgresql/offering/list/list.go index e1440975..8f51c4fb 100644 --- a/internal/cmd/postgresql/offering/list/list.go +++ b/internal/cmd/postgresql/offering/list/list.go @@ -2,6 +2,7 @@ package list import ( "context" + "encoding/json" "fmt" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" @@ -58,24 +59,7 @@ func NewCmd() *cobra.Command { offerings = offerings[:*model.Limit] } - // Show output as table - table := tables.NewTable() - table.SetHeader("NAME", "PLAN.ID", "PLAN.NAME", "PLAN.DESCRIPTION") - for i := range offerings { - o := offerings[i] - for j := range *o.Plans { - p := (*o.Plans)[j] - table.AddRow(*o.Name, *p.Id, *p.Name, *p.Description) - } - table.AddSeparator() - } - table.EnableAutoMergeOnColumns(1) - err = table.Render(cmd) - if err != nil { - return fmt.Errorf("render table: %w", err) - } - - return nil + return outputResult(cmd, model.OutputFormat, offerings) }, } @@ -108,3 +92,34 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *postgresql.A req := apiClient.GetOfferings(ctx, model.ProjectId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, offerings []postgresql.Offering) error { + switch outputFormat { + case globalflags.JSONOutputFormat: + details, err := json.MarshalIndent(offerings, "", " ") + if err != nil { + return fmt.Errorf("marshal PostgreSQL offerings: %w", err) + } + cmd.Println(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("NAME", "PLAN.ID", "PLAN.NAME", "PLAN.DESCRIPTION") + for i := range offerings { + o := offerings[i] + for j := range *o.Plans { + p := (*o.Plans)[j] + table.AddRow(*o.Name, *p.Id, *p.Name, *p.Description) + } + table.AddSeparator() + } + table.EnableAutoMergeOnColumns(1) + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/ske/cluster/describe/describe.go b/internal/cmd/ske/cluster/describe/describe.go index 37247b23..ce6b1dfe 100644 --- a/internal/cmd/ske/cluster/describe/describe.go +++ b/internal/cmd/ske/cluster/describe/describe.go @@ -7,6 +7,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" "github.com/spf13/cobra" @@ -47,14 +48,7 @@ func NewCmd() *cobra.Command { return fmt.Errorf("read SKE cluster: %w", err) } - // Show details - details, err := json.MarshalIndent(resp, "", " ") - if err != nil { - return fmt.Errorf("marshal SKE cluster: %w", err) - } - cmd.Println(string(details)) - - return nil + return outputResult(cmd, model.OutputFormat, resp) }, } configureFlags(cmd) @@ -87,3 +81,26 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *ske.APIClien req := apiClient.GetCluster(ctx, model.ProjectId, model.ClusterName) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, cluster *ske.ClusterResponse) error { + switch outputFormat { + case globalflags.TableOutputFormat: + table := tables.NewTable() + table.SetHeader("NAME", "STATE") + table.AddRow(*cluster.Name, *cluster.Status.Aggregated) + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + default: + details, err := json.MarshalIndent(cluster, "", " ") + if err != nil { + return fmt.Errorf("marshal SKE cluster: %w", err) + } + cmd.Println(string(details)) + + return nil + } +} diff --git a/internal/cmd/ske/cluster/list/list.go b/internal/cmd/ske/cluster/list/list.go index 14bd5aaf..fac7a351 100644 --- a/internal/cmd/ske/cluster/list/list.go +++ b/internal/cmd/ske/cluster/list/list.go @@ -2,6 +2,7 @@ package list import ( "context" + "encoding/json" "fmt" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" @@ -58,19 +59,7 @@ func NewCmd() *cobra.Command { clusters = clusters[:*model.Limit] } - // Show output as table - table := tables.NewTable() - table.SetHeader("NAME", "STATE") - for i := range clusters { - c := clusters[i] - table.AddRow(*c.Name, *c.Status.Aggregated) - } - err = table.Render(cmd) - if err != nil { - return fmt.Errorf("render table: %w", err) - } - - return nil + return outputResult(cmd, model.OutputFormat, clusters) }, } @@ -103,3 +92,29 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *ske.APIClien req := apiClient.GetClusters(ctx, model.ProjectId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, clusters []ske.ClusterResponse) error { + switch outputFormat { + case globalflags.JSONOutputFormat: + details, err := json.MarshalIndent(clusters, "", " ") + if err != nil { + return fmt.Errorf("marshal SKE cluster list: %w", err) + } + cmd.Println(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("NAME", "STATE") + for i := range clusters { + c := clusters[i] + table.AddRow(*c.Name, *c.Status.Aggregated) + } + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/ske/describe/describe.go b/internal/cmd/ske/describe/describe.go index 0c0825a8..f2186fce 100644 --- a/internal/cmd/ske/describe/describe.go +++ b/internal/cmd/ske/describe/describe.go @@ -7,6 +7,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" "github.com/spf13/cobra" "github.com/stackitcloud/stackit-sdk-go/services/ske" @@ -41,14 +42,7 @@ func NewCmd() *cobra.Command { return fmt.Errorf("read SKE project details: %w", err) } - // Show details - details, err := json.MarshalIndent(resp, "", " ") - if err != nil { - return fmt.Errorf("marshal SKE project details: %w", err) - } - cmd.Println(string(details)) - - return nil + return outputResult(cmd, model.OutputFormat, resp) }, } return cmd @@ -69,3 +63,26 @@ func buildRequest(ctx context.Context, model *flagModel, apiClient *ske.APIClien req := apiClient.GetProject(ctx, model.ProjectId) return req } + +func outputResult(cmd *cobra.Command, outputFormat string, project *ske.ProjectResponse) error { + switch outputFormat { + case globalflags.TableOutputFormat: + table := tables.NewTable() + table.SetHeader("ID", "STATE") + table.AddRow(*project.ProjectId, *project.State) + err := table.Render(cmd) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + default: + details, err := json.MarshalIndent(project, "", " ") + if err != nil { + return fmt.Errorf("marshal SKE project details: %w", err) + } + cmd.Println(string(details)) + + return nil + } +} diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 2b342aa6..ff8a74d1 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -79,6 +79,5 @@ func createFileIfNotExists(filePath string) error { } func setConfigDefaults() { - viper.SetDefault(OutputFormatKey, "default") viper.SetDefault(SessionTimeLimitKey, "2h") } diff --git a/internal/pkg/globalflags/global_flags.go b/internal/pkg/globalflags/global_flags.go index 55be7000..48eb1916 100644 --- a/internal/pkg/globalflags/global_flags.go +++ b/internal/pkg/globalflags/global_flags.go @@ -10,11 +10,13 @@ import ( ) const ( - ProjectIdFlag = "project-id" - OutputFormatFlag = "output-format" + ProjectIdFlag = "project-id" + OutputFormatFlag = "output-format" + JSONOutputFormat = "json" + TableOutputFormat = "table" ) -var outputFormatFlagOptions = []string{"default", "json", "table"} +var outputFormatFlagOptions = []string{JSONOutputFormat, TableOutputFormat} type GlobalFlagModel struct { ProjectId string