@@ -14,6 +14,7 @@ import (
1414 "github.com/spf13/cobra"
1515
1616 "github.com/terraform-docs/terraform-docs/cmd/completion/bash"
17+ "github.com/terraform-docs/terraform-docs/cmd/completion/fish"
1718 "github.com/terraform-docs/terraform-docs/cmd/completion/zsh"
1819)
1920
@@ -22,18 +23,19 @@ func NewCommand() *cobra.Command {
2223 cmd := & cobra.Command {
2324 Args : cobra .NoArgs ,
2425 Use : "completion SHELL" ,
25- Short : "Generate shell completion code for the specified shell (bash or zsh)" ,
26+ Short : "Generate shell completion code for the specified shell (bash, zsh,fish )" ,
2627 Long : longDescription ,
2728 }
2829
2930 // subcommands
3031 cmd .AddCommand (bash .NewCommand ())
3132 cmd .AddCommand (zsh .NewCommand ())
33+ cmd .AddCommand (fish .NewCommand ())
3234
3335 return cmd
3436}
3537
36- const longDescription = `Outputs terraform-doc shell completion for the given shell (bash or zsh)
38+ const longDescription = `Outputs terraform-doc shell completion for the given shell (bash, zsh,fish )
3739This depends on the bash-completion binary. Example installation instructions:
3840# for bash users
3941 $ terraform-doc completion bash > ~/.terraform-doc-completion
@@ -45,6 +47,9 @@ This depends on the bash-completion binary. Example installation instructions:
4547# or if zsh-completion is installed via homebrew
4648 % terraform-doc completion zsh > "${fpath[1]}/_terraform-doc"
4749
50+ # for fish users
51+ $ terraform-doc completion fish | source
52+
4853Additionally, you may want to output the completion to a file and source in your .bashrc
4954Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2
5055`
0 commit comments