Skip to content

Commit

Permalink
change marshal function to add indentation (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
GokceGK authored May 16, 2024
1 parent df56911 commit 322e202
Show file tree
Hide file tree
Showing 115 changed files with 116 additions and 116 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/argus/credentials/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials []argus.Ser

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(credentials)
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Argus credentials list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/argus/grafana/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func outputResult(p *print.Printer, inputModel *inputModel, grafanaConfigs *argu

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(grafanaConfigs)
details, err := yaml.MarshalWithOptions(grafanaConfigs, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Grafana configs: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/argus/instance/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Argus instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/argus/instance/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func outputResult(p *print.Printer, outputFormat string, instance *argus.GetInst

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instance)
details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Argus instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/argus/instance/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, instances []argus.Proje

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instances)
details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Argus instance list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/argus/plans/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, plans []argus.Plan) err

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(plans)
details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Argus plans: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/argus/scrape-config/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func outputResult(p *print.Printer, outputFormat string, config *argus.Job) erro

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(config)
details, err := yaml.MarshalWithOptions(config, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal scrape configuration: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/argus/scrape-config/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func outputResult(p *print.Printer, outputFormat string, configs []argus.Job) er

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(configs)
details, err := yaml.MarshalWithOptions(configs, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal scrape configurations list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/config/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func outputResult(p *print.Printer, outputFormat string, configData map[string]a
p.Outputln(string(details))
return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(configData)
details, err := yaml.MarshalWithOptions(configData, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal config list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/dns/record-set/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func outputResult(p *print.Printer, model *inputModel, zoneLabel string, resp *d

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal DNS record-set: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/dns/record-set/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func outputResult(p *print.Printer, outputFormat string, recordSet *dns.RecordSe

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(recordSet)
details, err := yaml.MarshalWithOptions(recordSet, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal DNS record set: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/dns/record-set/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func outputResult(p *print.Printer, outputFormat string, recordSets []dns.Record

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(recordSets)
details, err := yaml.MarshalWithOptions(recordSets, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal DNS record set list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/dns/zone/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal DNS zone: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/dns/zone/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func outputResult(p *print.Printer, outputFormat string, zone *dns.Zone) error {

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(zone)
details, err := yaml.MarshalWithOptions(zone, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal DNS zone: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/dns/zone/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func outputResult(p *print.Printer, outputFormat string, zones []dns.Zone) error

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(zones)
details, err := yaml.MarshalWithOptions(zones, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal DNS zone list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/load-balancer/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func outputResult(p *print.Printer, outputFormat string, loadBalancer *loadbalan

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(loadBalancer)
details, err := yaml.MarshalWithOptions(loadBalancer, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal load balancer: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/load-balancer/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func outputResult(p *print.Printer, outputFormat string, loadBalancers []loadbal

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(loadBalancers)
details, err := yaml.MarshalWithOptions(loadBalancers, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal load balancer list: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Load Balancer observability credentials: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials *loadbalanc

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(credentials)
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Load Balancer observability credentials: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials []loadbalan

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(credentials)
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Load Balancer observability credentials list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/load-balancer/quota/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func outputResult(p *print.Printer, outputFormat string, quota *loadbalancer.Get

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(quota)
details, err := yaml.MarshalWithOptions(quota, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal quota: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func outputResult(p *print.Printer, outputFormat string, targetPool loadbalancer

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(output)
details, err := yaml.MarshalWithOptions(output, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal load balancer: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logme/credentials/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal LogMe credentials: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logme/credentials/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials *logme.Cred

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(credentials)
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal LogMe credentials: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logme/credentials/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials []logme.Cre

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(credentials)
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal LogMe credentials list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logme/instance/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal LogMe instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logme/instance/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func outputResult(p *print.Printer, outputFormat string, instance *logme.Instanc

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instance)
details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal LogMe instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logme/instance/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, instances []logme.Insta

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instances)
details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal LogMe instance list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logme/plans/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, plans []logme.Offering)

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(plans)
details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal LogMe plans: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mariadb/credentials/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal Argus credentials list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mariadb/credentials/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials *mariadb.Cr

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(credentials)
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MariaDB credentials: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mariadb/credentials/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials []mariadb.C

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(credentials)
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MariaDB credentials list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mariadb/instance/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MariaDB instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mariadb/instance/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func outputResult(p *print.Printer, outputFormat string, instance *mariadb.Insta

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instance)
details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MariaDB instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mariadb/instance/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, instances []mariadb.Ins

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instances)
details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MariaDB instance list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mariadb/plans/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, plans []mariadb.Offerin

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(plans)
details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MariaDB plans: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/backup/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func outputResult(p *print.Printer, cmd *cobra.Command, outputFormat, restoreSta

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(backup)
details, err := yaml.MarshalWithOptions(backup, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MongoDB Flex backup: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/backup/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func outputResult(p *print.Printer, outputFormat string, backups []mongodbflex.B

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(backups)
details, err := yaml.MarshalWithOptions(backups, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MongoDB Flex backups list: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func outputResult(p *print.Printer, outputFormat string, restoreJobs []mongodbfl

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(restoreJobs)
details, err := yaml.MarshalWithOptions(restoreJobs, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MongoDB Flex restore jobs list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/backup/schedule/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func outputResult(p *print.Printer, outputFormat string, instance *mongodbflex.I

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(output)
details, err := yaml.MarshalWithOptions(output, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MongoDB Flex backup schedule: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/instance/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MongoDBFlex instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/instance/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func outputResult(p *print.Printer, outputFormat string, instance *mongodbflex.I

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instance)
details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MongoDB Flex instance: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/instance/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, instances []mongodbflex

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(instances)
details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal MongoDB Flex instance list: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/mongodbflex/instance/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res

return nil
case print.YAMLOutputFormat:
details, err := yaml.Marshal(resp)
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
if err != nil {
return fmt.Errorf("marshal update MongoDBFlex instance: %w", err)
}
Expand Down
Loading

0 comments on commit 322e202

Please sign in to comment.