Merge pull request #516 from khos2ow/remove-deprecated

Remove deprecated `--sort-by-XXX`, `--show-all`, and `--hide-all` flags
This commit is contained in:
Khosrow Moossavi
2021-06-02 13:03:29 -04:00
committed by GitHub
19 changed files with 96 additions and 122 deletions

View File

@@ -62,25 +62,13 @@ 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+"]")
// deprecated flags ==>
cmd.PersistentFlags().BoolVar(new(bool), "show-all", true, "show all sections")
cmd.PersistentFlags().BoolVar(new(bool), "hide-all", false, "hide all sections (default false)")
cmd.PersistentFlags().MarkDeprecated("show-all", "more information: https://terraform-docs.io/user-guide/how-to/#visibility-of-sections\n\n") //nolint:errcheck,gosec
cmd.PersistentFlags().MarkDeprecated("hide-all", "more information: https://terraform-docs.io/user-guide/how-to/#visibility-of-sections\n\n") //nolint:errcheck,gosec
cmd.PersistentFlags().BoolVar(&config.Sort.Criteria.Required, "sort-by-required", false, "sort items by name and print required ones first (default false)")
cmd.PersistentFlags().BoolVar(&config.Sort.Criteria.Type, "sort-by-type", false, "sort items by type of them (default false)")
cmd.PersistentFlags().MarkDeprecated("sort-by-required", "use '--sort-by required' instead\n\n") //nolint:errcheck,gosec
cmd.PersistentFlags().MarkDeprecated("sort-by-type", "use '--sort-by type' instead\n\n") //nolint:errcheck,gosec
// <==
cmd.PersistentFlags().StringVar(&config.HeaderFrom, "header-from", "main.tf", "relative path of a file to read header from")
cmd.PersistentFlags().StringVar(&config.FooterFrom, "footer-from", "", "relative path of a file to read footer from (default \"\")")

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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)

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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)

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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)

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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)

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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 "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->")
--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")
```

View File

@@ -69,8 +69,8 @@ sections:
hide: []
show: []
hide-all: false # deprecated in v0.13.0
show-all: true # deprecated in v0.13.0
hide-all: false # deprecated in v0.13.0, removed in v0.15.0
show-all: true # deprecated in v0.13.0, removed in v0.15.0
content: ""
@@ -111,7 +111,8 @@ settings:
- `sections.show-all` and `sections.show`
**Note:** As of `v0.13.0`, `sections.hide-all` and `sections.show-all` are deprecated
and removed in favor of explicit use of `sections.hide` and `sections.show`.
in favor of explicit use of `sections.hide` and `sections.show`, and they are removed
as of `v0.15.0`.
## Version
@@ -182,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`)
@@ -193,7 +195,8 @@ The following options are supported and can be used for `sections.show` and
- `resources` (since `v0.11.0`)
**Note:** As of `v0.13.0`, `sections.hide-all` and `sections.show-all` are deprecated
and removed in favor of explicit use of `sections.hide` and `sections.show`.
in favor of explicit use of `sections.hide` and `sections.show`, and they are removed
as of `v0.15.0`.
## Content

View File

@@ -61,8 +61,8 @@ options:
- `--show <name>`
- `--hide <name>`
- `--show-all` (deprecated in `v0.13.0`)
- `--hide-all` (deprecated in `v0.13.0`)
- `--show-all` (deprecated in `v0.13.0`, removed in `v0.15.0`)
- `--hide-all` (deprecated in `v0.13.0`, removed in `v0.15.0`)
As of `v0.13.0` flags `--show-all` and `--hide-all` are deprecated in favor of
explicit use of `--show` and `--hide`. In other words when `--show <section>` is

View File

@@ -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
}
}
@@ -342,26 +344,15 @@ var allSorts = []string{
// SortTypes list.
var SortTypes = strings.Join(allSorts, ", ")
type sortby struct {
Name bool `name:"name"`
Required bool `name:"required"`
Type bool `name:"type"`
}
type sort struct {
Enabled bool `mapstructure:"enabled"`
By string `mapstructure:"by"`
Criteria sortby `mapstructure:"-"`
Enabled bool `mapstructure:"enabled"`
By string `mapstructure:"by"`
}
func defaultSort() sort {
return sort{
Enabled: true,
By: sortName,
Criteria: sortby{
Name: true,
Required: false,
Type: false,
},
}
}
@@ -369,9 +360,6 @@ func (s *sort) validate() error {
if !contains(allSorts, s.By) {
return fmt.Errorf("'%s' is not a valid sort type", s.By)
}
if s.Criteria.Required && s.Criteria.Type {
return fmt.Errorf("'--sort-by-required' and '--sort-by-type' can't be used together")
}
return nil
}
@@ -461,11 +449,6 @@ func (c *Config) process() error { //nolint:gocyclo
}
}
// Enable specified sort criteria
c.Sort.Criteria.Name = c.Sort.Enabled && c.Sort.By == sortName
c.Sort.Criteria.Required = c.Sort.Enabled && c.Sort.By == sortRequired
c.Sort.Criteria.Type = c.Sort.Enabled && c.Sort.By == sortType
return nil
}
@@ -499,9 +482,9 @@ func (c *Config) extract() (*print.Settings, *terraform.Options) {
options.OutputValuesPath = c.OutputValues.From
// sort
options.SortBy.Name = c.Sort.Enabled && c.Sort.Criteria.Name
options.SortBy.Required = c.Sort.Enabled && c.Sort.Criteria.Required
options.SortBy.Type = c.Sort.Enabled && c.Sort.Criteria.Type
options.SortBy.Name = c.Sort.Enabled && c.Sort.By == sortName
options.SortBy.Required = c.Sort.Enabled && c.Sort.By == sortRequired
options.SortBy.Type = c.Sort.Enabled && c.Sort.By == sortType
// settings
settings.EscapeCharacters = c.Settings.Escape