diff --git a/cmd/root.go b/cmd/root.go index 3f7f1b6..53b3f84 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -62,9 +62,9 @@ func NewCommand() *cobra.Command { cmd.PersistentFlags().StringSliceVar(&config.Sections.Show, "show", []string{}, "show section ["+cli.AllSections+"]") cmd.PersistentFlags().StringSliceVar(&config.Sections.Hide, "hide", []string{}, "hide section ["+cli.AllSections+"]") - cmd.PersistentFlags().StringVar(&config.Output.File, "output-file", "", "File path to insert output into (default \"\")") - cmd.PersistentFlags().StringVar(&config.Output.Mode, "output-mode", "inject", "Output to file method ["+cli.OutputModes+"]") - cmd.PersistentFlags().StringVar(&config.Output.Template, "output-template", cli.OutputTemplate, "Output template") + cmd.PersistentFlags().StringVar(&config.Output.File, "output-file", "", "file path to insert output into (default \"\")") + cmd.PersistentFlags().StringVar(&config.Output.Mode, "output-mode", "inject", "output to file method ["+cli.OutputModes+"]") + cmd.PersistentFlags().StringVar(&config.Output.Template, "output-template", cli.OutputTemplate, "output template") cmd.PersistentFlags().BoolVar(&config.Sort.Enabled, "sort", true, "sort items") cmd.PersistentFlags().StringVar(&config.Sort.By, "sort-by", "name", "sort items by criteria ["+cli.SortTypes+"]") diff --git a/docs/reference/asciidoc-document.md b/docs/reference/asciidoc-document.md index 441735d..32f5a38 100644 --- a/docs/reference/asciidoc-document.md +++ b/docs/reference/asciidoc-document.md @@ -30,16 +30,16 @@ terraform-docs asciidoc document [PATH] [flags] --default show Default column or section (default true) --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2) - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") --required show Required column or section (default true) --sensitive show Sensitive column or section (default true) - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") --type show Type column or section (default true) diff --git a/docs/reference/asciidoc-table.md b/docs/reference/asciidoc-table.md index 65b6d33..c64b21f 100644 --- a/docs/reference/asciidoc-table.md +++ b/docs/reference/asciidoc-table.md @@ -30,16 +30,16 @@ terraform-docs asciidoc table [PATH] [flags] --default show Default column or section (default true) --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2) - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") --required show Required column or section (default true) --sensitive show Sensitive column or section (default true) - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") --type show Type column or section (default true) diff --git a/docs/reference/asciidoc.md b/docs/reference/asciidoc.md index c2f530e..1a5843b 100644 --- a/docs/reference/asciidoc.md +++ b/docs/reference/asciidoc.md @@ -34,13 +34,13 @@ terraform-docs asciidoc [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/json.md b/docs/reference/json.md index 005b57e..9e7f6b4 100644 --- a/docs/reference/json.md +++ b/docs/reference/json.md @@ -29,13 +29,13 @@ terraform-docs json [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/markdown-document.md b/docs/reference/markdown-document.md index b7fb44d..1e68410 100644 --- a/docs/reference/markdown-document.md +++ b/docs/reference/markdown-document.md @@ -31,17 +31,17 @@ terraform-docs markdown document [PATH] [flags] --escape escape special characters (default true) --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --html use HTML tags in genereted output (default true) --indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2) - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") --required show Required column or section (default true) --sensitive show Sensitive column or section (default true) - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") --type show Type column or section (default true) diff --git a/docs/reference/markdown-table.md b/docs/reference/markdown-table.md index 7d6ed14..8f52d1b 100644 --- a/docs/reference/markdown-table.md +++ b/docs/reference/markdown-table.md @@ -31,17 +31,17 @@ terraform-docs markdown table [PATH] [flags] --escape escape special characters (default true) --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --html use HTML tags in genereted output (default true) --indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2) - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") --required show Required column or section (default true) --sensitive show Sensitive column or section (default true) - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") --type show Type column or section (default true) diff --git a/docs/reference/markdown.md b/docs/reference/markdown.md index 2303099..ef48ffe 100644 --- a/docs/reference/markdown.md +++ b/docs/reference/markdown.md @@ -36,13 +36,13 @@ terraform-docs markdown [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/pretty.md b/docs/reference/pretty.md index 8a143e7..4510381 100644 --- a/docs/reference/pretty.md +++ b/docs/reference/pretty.md @@ -29,13 +29,13 @@ terraform-docs pretty [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/terraform-docs.md b/docs/reference/terraform-docs.md index 69f3649..f06b228 100644 --- a/docs/reference/terraform-docs.md +++ b/docs/reference/terraform-docs.md @@ -23,13 +23,13 @@ terraform-docs [PATH] [flags] --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") -h, --help help for terraform-docs - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/tfvars-hcl.md b/docs/reference/tfvars-hcl.md index f9e016e..e191af0 100644 --- a/docs/reference/tfvars-hcl.md +++ b/docs/reference/tfvars-hcl.md @@ -29,13 +29,13 @@ terraform-docs tfvars hcl [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/tfvars-json.md b/docs/reference/tfvars-json.md index 2149b5a..f7d2ef5 100644 --- a/docs/reference/tfvars-json.md +++ b/docs/reference/tfvars-json.md @@ -28,13 +28,13 @@ terraform-docs tfvars json [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/tfvars.md b/docs/reference/tfvars.md index 3e40e29..6947fca 100644 --- a/docs/reference/tfvars.md +++ b/docs/reference/tfvars.md @@ -24,13 +24,13 @@ Generate terraform.tfvars of inputs. -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/toml.md b/docs/reference/toml.md index c23987f..a4e9c66 100644 --- a/docs/reference/toml.md +++ b/docs/reference/toml.md @@ -28,13 +28,13 @@ terraform-docs toml [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/xml.md b/docs/reference/xml.md index ce5b1ed..75f93d6 100644 --- a/docs/reference/xml.md +++ b/docs/reference/xml.md @@ -28,13 +28,13 @@ terraform-docs xml [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/reference/yaml.md b/docs/reference/yaml.md index a5f5131..9230658 100644 --- a/docs/reference/yaml.md +++ b/docs/reference/yaml.md @@ -28,13 +28,13 @@ terraform-docs yaml [PATH] [flags] -c, --config string config file name (default ".terraform-docs.yml") --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") - --hide strings hide section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] - --output-file string File path to insert output into (default "") - --output-mode string Output to file method [inject, replace] (default "inject") - --output-template string Output template (default "\n{{ .Content }}\n") + --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --output-file string file path to insert output into (default "") + --output-mode string output to file method [inject, replace] (default "inject") + --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") - --show strings show section [data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] + --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") ``` diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index a0d4955..c9084c4 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -183,6 +183,7 @@ Since `v0.10.0` The following options are supported and can be used for `sections.show` and `sections.hide`: +- `all` (since `v0.15.0`) - `data-sources` (since `v0.13.0`) - `header` - `footer` (since `v0.12.0`) diff --git a/internal/cli/config.go b/internal/cli/config.go index b83b614..ed3c7e8 100644 --- a/internal/cli/config.go +++ b/internal/cli/config.go @@ -88,6 +88,7 @@ func DefaultConfig() *Config { } const ( + sectionAll = "all" sectionDataSources = "data-sources" sectionFooter = "footer" sectionHeader = "header" @@ -100,6 +101,7 @@ const ( ) var allSections = []string{ + sectionAll, sectionDataSources, sectionFooter, sectionHeader, @@ -168,12 +170,12 @@ func (s *sections) visibility(section string) bool { return true } for _, n := range s.Show { - if n == section { + if n == sectionAll || n == section { return true } } for _, n := range s.Hide { - if n == section { + if n == sectionAll || n == section { return false } }