Skip to content

Commit 322e202

Browse files
authored
change marshal function to add indentation (#323)
1 parent df56911 commit 322e202

File tree

115 files changed

+116
-116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+116
-116
lines changed

internal/cmd/argus/credentials/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func outputResult(p *print.Printer, outputFormat string, credentials []argus.Ser
134134

135135
return nil
136136
case print.YAMLOutputFormat:
137-
details, err := yaml.Marshal(credentials)
137+
details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true))
138138
if err != nil {
139139
return fmt.Errorf("marshal Argus credentials list: %w", err)
140140
}

internal/cmd/argus/grafana/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func outputResult(p *print.Printer, inputModel *inputModel, grafanaConfigs *argu
135135

136136
return nil
137137
case print.YAMLOutputFormat:
138-
details, err := yaml.Marshal(grafanaConfigs)
138+
details, err := yaml.MarshalWithOptions(grafanaConfigs, yaml.IndentSequence(true))
139139
if err != nil {
140140
return fmt.Errorf("marshal Grafana configs: %w", err)
141141
}

internal/cmd/argus/instance/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp
210210

211211
return nil
212212
case print.YAMLOutputFormat:
213-
details, err := yaml.Marshal(resp)
213+
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
214214
if err != nil {
215215
return fmt.Errorf("marshal Argus instance: %w", err)
216216
}

internal/cmd/argus/instance/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func outputResult(p *print.Printer, outputFormat string, instance *argus.GetInst
108108

109109
return nil
110110
case print.YAMLOutputFormat:
111-
details, err := yaml.Marshal(instance)
111+
details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true))
112112
if err != nil {
113113
return fmt.Errorf("marshal Argus instance: %w", err)
114114
}

internal/cmd/argus/instance/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, instances []argus.Proje
140140

141141
return nil
142142
case print.YAMLOutputFormat:
143-
details, err := yaml.Marshal(instances)
143+
details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true))
144144
if err != nil {
145145
return fmt.Errorf("marshal Argus instance list: %w", err)
146146
}

internal/cmd/argus/plans/plans.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func outputResult(p *print.Printer, outputFormat string, plans []argus.Plan) err
140140

141141
return nil
142142
case print.YAMLOutputFormat:
143-
details, err := yaml.Marshal(plans)
143+
details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true))
144144
if err != nil {
145145
return fmt.Errorf("marshal Argus plans: %w", err)
146146
}

internal/cmd/argus/scrape-config/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func outputResult(p *print.Printer, outputFormat string, config *argus.Job) erro
110110

111111
return nil
112112
case print.YAMLOutputFormat:
113-
details, err := yaml.Marshal(config)
113+
details, err := yaml.MarshalWithOptions(config, yaml.IndentSequence(true))
114114
if err != nil {
115115
return fmt.Errorf("marshal scrape configuration: %w", err)
116116
}

internal/cmd/argus/scrape-config/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func outputResult(p *print.Printer, outputFormat string, configs []argus.Job) er
137137

138138
return nil
139139
case print.YAMLOutputFormat:
140-
details, err := yaml.Marshal(configs)
140+
details, err := yaml.MarshalWithOptions(configs, yaml.IndentSequence(true))
141141
if err != nil {
142142
return fmt.Errorf("marshal scrape configurations list: %w", err)
143143
}

internal/cmd/config/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func outputResult(p *print.Printer, outputFormat string, configData map[string]a
7575
p.Outputln(string(details))
7676
return nil
7777
case print.YAMLOutputFormat:
78-
details, err := yaml.Marshal(configData)
78+
details, err := yaml.MarshalWithOptions(configData, yaml.IndentSequence(true))
7979
if err != nil {
8080
return fmt.Errorf("marshal config list: %w", err)
8181
}

internal/cmd/dns/record-set/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func outputResult(p *print.Printer, model *inputModel, zoneLabel string, resp *d
177177

178178
return nil
179179
case print.YAMLOutputFormat:
180-
details, err := yaml.Marshal(resp)
180+
details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true))
181181
if err != nil {
182182
return fmt.Errorf("marshal DNS record-set: %w", err)
183183
}

0 commit comments

Comments
 (0)