Files
terraform-docs/cmd/completion.go
Thomas Alton b8da8c5020 feat: Support Terraform 0.12.x configuration (#113)
* Support 0.12 configuration

* Move code out of GOPATH for CircleCI

* cleanup

* Rename 'variables' back to 'input' just for now

* Normalizing 'print.s.Settings' usage

* Normalize settings continued

* Remove '--providers' functionality for now

* Adjust 'commands' based on moarta's changes

* Adjust 'pkg/doc' based on moarta's changes

* Adjust 'pkg/print/json' based on moarta's changes

* Fix json tests

* don't trim whitespaces from .tf files

* Adjust 'pkg/print/pretty' based on moarta's changes

* Fix pretty tests

* don't trim whitespaces from .golden files

* Show 'n/a' for empty description for 'pretty'

* Show 'any' if type of input variable is missing

* Adjust 'pkg/print/markdown/document' based on moarta's changes

* Fix document tests

* move back vendor files

* Adjust 'pkg/print/markdown/table' based on moarta's changes

* fix lint issue

* Fix table tests

* figure out input type based on default value if tpye not explicitly defined

* don't escape ( ) [ ] { }, as they don't cause any issue

Authored-by: Thomas Alton <thomas.alton@gmail.com>
Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
2019-12-20 15:07:29 -05:00

41 lines
906 B
Go

package cmd
import (
"os"
"github.com/spf13/cobra"
)
var completionCmd = &cobra.Command{
Args: cobra.NoArgs,
Use: "completion SHELL",
Short: "Generate autocomplete for terraform-docs",
Long: "Generate autocomplete for terraform-docs",
}
var bashCompletionCmd = &cobra.Command{
Args: cobra.NoArgs,
Use: "bash",
Short: "Generate autocomplete for bash",
Long: "Generate autocomplete for bash",
Run: func(cmd *cobra.Command, args []string) {
_ = rootCmd.GenBashCompletion(os.Stdout)
},
}
var zshCompletionCmd = &cobra.Command{
Args: cobra.NoArgs,
Use: "zsh",
Short: "Generate autocomplete for zsh",
Long: "Generate autocomplete for zsh",
Run: func(cmd *cobra.Command, args []string) {
_ = rootCmd.GenZshCompletion(os.Stdout)
},
}
func init() {
completionCmd.AddCommand(bashCompletionCmd)
completionCmd.AddCommand(zshCompletionCmd)
rootCmd.AddCommand(completionCmd)
}