Skip to content

Commit f613750

Browse files
authored
Add 'HideEmpy' section bool flag
* Add 'HideEmpy' section to Settings Signed-off-by: akatsadimas <nkatsadim@gmail.com> * Address review comments fixed linting and docs, moved HideEmpty to Settings struct Signed-off-by: akatsadimas <nkatsadim@gmail.com> * Address review comment document hideempty configuration option Signed-off-by: akatsadimas <nkatsadim@gmail.com> * Address review comments - improve docs Signed-off-by: akatsadimas <nkatsadim@gmail.com>
1 parent c901b89 commit f613750

Some content is hidden

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

47 files changed

+285
-91
lines changed

cmd/asciidoc/asciidoc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func NewCommand(runtime *cli.Runtime, config *cli.Config) *cobra.Command {
3333
// flags
3434
cmd.PersistentFlags().BoolVar(&config.Settings.Anchor, "anchor", true, "create anchor links")
3535
cmd.PersistentFlags().BoolVar(&config.Settings.Default, "default", true, "show Default column or section")
36+
cmd.PersistentFlags().BoolVar(&config.Settings.HideEmpty, "hide-empty", false, "hide empty sections (default false)")
3637
cmd.PersistentFlags().IntVar(&config.Settings.Indent, "indent", 2, "indention level of AsciiDoc sections [1, 2, 3, 4, 5]")
3738
cmd.PersistentFlags().BoolVar(&config.Settings.Required, "required", true, "show Required column or section")
3839
cmd.PersistentFlags().BoolVar(&config.Settings.Sensitive, "sensitive", true, "show Sensitive column or section")

cmd/markdown/markdown.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func NewCommand(runtime *cli.Runtime, config *cli.Config) *cobra.Command {
3535
cmd.PersistentFlags().BoolVar(&config.Settings.Default, "default", true, "show Default column or section")
3636
cmd.PersistentFlags().BoolVar(&config.Settings.Escape, "escape", true, "escape special characters")
3737
cmd.PersistentFlags().BoolVar(&config.Settings.HTML, "html", true, "use HTML tags in genereted output")
38+
cmd.PersistentFlags().BoolVar(&config.Settings.HideEmpty, "hide-empty", false, "hide empty sections (default false)")
3839
cmd.PersistentFlags().IntVar(&config.Settings.Indent, "indent", 2, "indention level of Markdown sections [1, 2, 3, 4, 5]")
3940
cmd.PersistentFlags().BoolVar(&config.Settings.Required, "required", true, "show Required column or section")
4041
cmd.PersistentFlags().BoolVar(&config.Settings.Sensitive, "sensitive", true, "show Sensitive column or section")

docs/reference/asciidoc-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ terraform-docs asciidoc document [PATH] [flags]
3131
--footer-from string relative path of a file to read footer from (default "")
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]
34+
--hide-empty hide empty sections (default false)
3435
--indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2)
3536
--lockfile read .terraform.lock.hcl if exist (default true)
3637
--output-check check if content of output file is up to date (default false)

docs/reference/asciidoc-table.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ terraform-docs asciidoc table [PATH] [flags]
3131
--footer-from string relative path of a file to read footer from (default "")
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]
34+
--hide-empty hide empty sections (default false)
3435
--indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2)
3536
--lockfile read .terraform.lock.hcl if exist (default true)
3637
--output-check check if content of output file is up to date (default false)

docs/reference/asciidoc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ terraform-docs asciidoc [PATH] [flags]
2222
--anchor create anchor links (default true)
2323
--default show Default column or section (default true)
2424
-h, --help help for asciidoc
25+
--hide-empty hide empty sections (default false)
2526
--indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2)
2627
--required show Required column or section (default true)
2728
--sensitive show Sensitive column or section (default true)

docs/reference/markdown-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ terraform-docs markdown document [PATH] [flags]
3232
--footer-from string relative path of a file to read footer from (default "")
3333
--header-from string relative path of a file to read header from (default "main.tf")
3434
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
35+
--hide-empty hide empty sections (default false)
3536
--html use HTML tags in genereted output (default true)
3637
--indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2)
3738
--lockfile read .terraform.lock.hcl if exist (default true)

docs/reference/markdown-table.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ terraform-docs markdown table [PATH] [flags]
3232
--footer-from string relative path of a file to read footer from (default "")
3333
--header-from string relative path of a file to read header from (default "main.tf")
3434
--hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources]
35+
--hide-empty hide empty sections (default false)
3536
--html use HTML tags in genereted output (default true)
3637
--indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2)
3738
--lockfile read .terraform.lock.hcl if exist (default true)

docs/reference/markdown.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ terraform-docs markdown [PATH] [flags]
2323
--default show Default column or section (default true)
2424
--escape escape special characters (default true)
2525
-h, --help help for markdown
26+
--hide-empty hide empty sections (default false)
2627
--html use HTML tags in genereted output (default true)
2728
--indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2)
2829
--required show Required column or section (default true)

docs/user-guide/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ settings:
9999
default: true
100100
description: false
101101
escape: true
102+
hide-empty: false
102103
html: true
103104
indent: 2
104105
lockfile: true

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/spf13/pflag v1.0.5
1515
github.com/spf13/viper v1.8.1
1616
github.com/stretchr/testify v1.7.0
17-
github.com/terraform-docs/plugin-sdk v0.3.1-0.20210512170044-49b620c0a2da
17+
github.com/terraform-docs/plugin-sdk v0.3.1-0.20210825180722-c52e9860f575
1818
github.com/terraform-docs/terraform-config-inspect v0.0.0-20210728164355-9c1f178932fa
1919
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
2020
honnef.co/go/tools v0.2.0

0 commit comments

Comments
 (0)