Skip to content

Commit 21eaab4

Browse files
rickhlxkhos2ow
authored andcommitted
add output-check option for outputs
adding option to compare outputted file with generated terraform-doc and fail if different Signed-off-by: Ricardo Herrera <rickhl@outlook.com> Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
1 parent f694e50 commit 21eaab4

20 files changed

+70
-0
lines changed

cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func NewCommand() *cobra.Command {
6565
cmd.PersistentFlags().StringVar(&config.Output.File, "output-file", "", "file path to insert output into (default \"\")")
6666
cmd.PersistentFlags().StringVar(&config.Output.Mode, "output-mode", "inject", "output to file method ["+cli.OutputModes+"]")
6767
cmd.PersistentFlags().StringVar(&config.Output.Template, "output-template", cli.OutputTemplate, "output template")
68+
cmd.PersistentFlags().BoolVar(&config.Output.Check, "output-check", false, "check if content of output file is up to date (default false)")
6869

6970
cmd.PersistentFlags().BoolVar(&config.Sort.Enabled, "sort", true, "sort items")
7071
cmd.PersistentFlags().StringVar(&config.Sort.By, "sort-by", "name", "sort items by criteria ["+cli.SortTypes+"]")

docs/reference/asciidoc-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ terraform-docs asciidoc document [PATH] [flags]
3232
--header-from string relative path of a file to read header from (default "main.tf")
3333
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
3434
--indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2)
35+
--output-check check if content of output file is up to date (default false)
3536
--output-file string file path to insert output into (default "")
3637
--output-mode string output to file method [inject, replace] (default "inject")
3738
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/asciidoc-table.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ terraform-docs asciidoc table [PATH] [flags]
3232
--header-from string relative path of a file to read header from (default "main.tf")
3333
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
3434
--indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2)
35+
--output-check check if content of output file is up to date (default false)
3536
--output-file string file path to insert output into (default "")
3637
--output-mode string output to file method [inject, replace] (default "inject")
3738
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/asciidoc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ terraform-docs asciidoc [PATH] [flags]
3535
--footer-from string relative path of a file to read footer from (default "")
3636
--header-from string relative path of a file to read header from (default "main.tf")
3737
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
38+
--output-check check if content of output file is up to date (default false)
3839
--output-file string file path to insert output into (default "")
3940
--output-mode string output to file method [inject, replace] (default "inject")
4041
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/json.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ terraform-docs json [PATH] [flags]
3030
--footer-from string relative path of a file to read footer from (default "")
3131
--header-from string relative path of a file to read header from (default "main.tf")
3232
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
33+
--output-check check if content of output file is up to date (default false)
3334
--output-file string file path to insert output into (default "")
3435
--output-mode string output to file method [inject, replace] (default "inject")
3536
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/markdown-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ terraform-docs markdown document [PATH] [flags]
3434
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
3535
--html use HTML tags in genereted output (default true)
3636
--indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2)
37+
--output-check check if content of output file is up to date (default false)
3738
--output-file string file path to insert output into (default "")
3839
--output-mode string output to file method [inject, replace] (default "inject")
3940
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/markdown-table.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ terraform-docs markdown table [PATH] [flags]
3434
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
3535
--html use HTML tags in genereted output (default true)
3636
--indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2)
37+
--output-check check if content of output file is up to date (default false)
3738
--output-file string file path to insert output into (default "")
3839
--output-mode string output to file method [inject, replace] (default "inject")
3940
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/markdown.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ terraform-docs markdown [PATH] [flags]
3737
--footer-from string relative path of a file to read footer from (default "")
3838
--header-from string relative path of a file to read header from (default "main.tf")
3939
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
40+
--output-check check if content of output file is up to date (default false)
4041
--output-file string file path to insert output into (default "")
4142
--output-mode string output to file method [inject, replace] (default "inject")
4243
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/pretty.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ terraform-docs pretty [PATH] [flags]
3030
--footer-from string relative path of a file to read footer from (default "")
3131
--header-from string relative path of a file to read header from (default "main.tf")
3232
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
33+
--output-check check if content of output file is up to date (default false)
3334
--output-file string file path to insert output into (default "")
3435
--output-mode string output to file method [inject, replace] (default "inject")
3536
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

docs/reference/terraform-docs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ terraform-docs [PATH] [flags]
2424
--header-from string relative path of a file to read header from (default "main.tf")
2525
-h, --help help for terraform-docs
2626
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
27+
--output-check check if content of output file is up to date (default false)
2728
--output-file string file path to insert output into (default "")
2829
--output-mode string output to file method [inject, replace] (default "inject")
2930
--output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")

0 commit comments

Comments
 (0)