Skip to content

Commit 4dc536f

Browse files
committed
Fix new --use-indent-lines wiring in code
Use `reportOptions.useIndentLines` when generating reports. Add new flag to generated Markdown documents.
1 parent b77d8bf commit 4dc536f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.docs/commands/dyff_between.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dyff between [flags] <from> <to>
2727
-v, --ignore-value-changes exclude changes in values
2828
--detect-renames enable detection for renames (document level for Kubernetes resources) (default true)
2929
-o, --output string specify the output style, supported styles: human, brief, github, gitlab, gitea (default "human")
30+
--use-indent-lines use indent lines in the output (default true)
3031
-b, --omit-header omit the dyff summary header
3132
-s, --set-exit-code set program exit code, with 0 meaning no difference, 1 for differences detected, and 255 for program error
3233
-l, --no-table-style do not place blocks next to each other, always use one row per text block

.docs/commands/dyff_last-applied.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dyff last-applied [flags]
2828
-v, --ignore-value-changes exclude changes in values
2929
--detect-renames enable detection for renames (document level for Kubernetes resources) (default true)
3030
-o, --output string specify the output style, supported styles: human, brief, github, gitlab, gitea (default "human")
31+
--use-indent-lines use indent lines in the output (default true)
3132
-b, --omit-header omit the dyff summary header
3233
-s, --set-exit-code set program exit code, with 0 meaning no difference, 1 for differences detected, and 255 for program error
3334
-l, --no-table-style do not place blocks next to each other, always use one row per text block

internal/cmd/common.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func applyReportOptionsFlags(cmd *cobra.Command) {
9898

9999
// Main output preferences
100100
cmd.Flags().StringVarP(&reportOptions.style, "output", "o", defaults.style, "specify the output style, supported styles: human, brief, github, gitlab, gitea")
101-
cmd.Flags().BoolVarP(&reportOptions.useIndentLines, "use-indent-lines", "u", defaults.useIndentLines, "use indent lines in the output")
101+
cmd.Flags().BoolVar(&reportOptions.useIndentLines, "use-indent-lines", defaults.useIndentLines, "use indent lines in the output")
102102
cmd.Flags().BoolVarP(&reportOptions.omitHeader, "omit-header", "b", defaults.omitHeader, "omit the dyff summary header")
103103
cmd.Flags().BoolVarP(&reportOptions.exitWithCode, "set-exit-code", "s", defaults.exitWithCode, "set program exit code, with 0 meaning no difference, 1 for differences detected, and 255 for program error")
104104

@@ -220,7 +220,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error {
220220
reportWriter = &dyff.HumanReport{
221221
Report: report,
222222
Indent: 2,
223-
UseIndentLines: true,
223+
UseIndentLines: reportOptions.useIndentLines,
224224
DoNotInspectCerts: reportOptions.doNotInspectCerts,
225225
NoTableStyle: reportOptions.noTableStyle,
226226
OmitHeader: reportOptions.omitHeader,
@@ -238,7 +238,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error {
238238
HumanReport: dyff.HumanReport{
239239
Report: report,
240240
Indent: 0,
241-
UseIndentLines: true,
241+
UseIndentLines: reportOptions.useIndentLines,
242242
DoNotInspectCerts: reportOptions.doNotInspectCerts,
243243
NoTableStyle: true,
244244
OmitHeader: true,
@@ -257,7 +257,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error {
257257
HumanReport: dyff.HumanReport{
258258
Report: report,
259259
Indent: 0,
260-
UseIndentLines: true,
260+
UseIndentLines: reportOptions.useIndentLines,
261261
DoNotInspectCerts: reportOptions.doNotInspectCerts,
262262
NoTableStyle: true,
263263
OmitHeader: true,
@@ -276,7 +276,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error {
276276
HumanReport: dyff.HumanReport{
277277
Report: report,
278278
Indent: 0,
279-
UseIndentLines: true,
279+
UseIndentLines: reportOptions.useIndentLines,
280280
DoNotInspectCerts: reportOptions.doNotInspectCerts,
281281
NoTableStyle: true,
282282
OmitHeader: true,

0 commit comments

Comments
 (0)