(out io.Writer)
| 90 | var disableCompDescriptions bool |
| 91 | |
| 92 | func newCompletionCmd(out io.Writer) *cobra.Command { |
| 93 | cmd := &cobra.Command{ |
| 94 | Use: "completion", |
| 95 | Short: "generate autocompletion scripts for the specified shell", |
| 96 | Long: completionDesc, |
| 97 | Args: require.NoArgs, |
| 98 | } |
| 99 | |
| 100 | bash := &cobra.Command{ |
| 101 | Use: "bash", |
| 102 | Short: "generate autocompletion script for bash", |
| 103 | Long: bashCompDesc, |
| 104 | Args: require.NoArgs, |
| 105 | ValidArgsFunction: noMoreArgsCompFunc, |
| 106 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 107 | return runCompletionBash(out, cmd) |
| 108 | }, |
| 109 | } |
| 110 | bash.Flags().BoolVar(&disableCompDescriptions, noDescFlagName, false, noDescFlagText) |
| 111 | |
| 112 | zsh := &cobra.Command{ |
| 113 | Use: "zsh", |
| 114 | Short: "generate autocompletion script for zsh", |
| 115 | Long: zshCompDesc, |
| 116 | Args: require.NoArgs, |
| 117 | ValidArgsFunction: noMoreArgsCompFunc, |
| 118 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 119 | return runCompletionZsh(out, cmd) |
| 120 | }, |
| 121 | } |
| 122 | zsh.Flags().BoolVar(&disableCompDescriptions, noDescFlagName, false, noDescFlagText) |
| 123 | |
| 124 | fish := &cobra.Command{ |
| 125 | Use: "fish", |
| 126 | Short: "generate autocompletion script for fish", |
| 127 | Long: fishCompDesc, |
| 128 | Args: require.NoArgs, |
| 129 | ValidArgsFunction: noMoreArgsCompFunc, |
| 130 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 131 | return runCompletionFish(out, cmd) |
| 132 | }, |
| 133 | } |
| 134 | fish.Flags().BoolVar(&disableCompDescriptions, noDescFlagName, false, noDescFlagText) |
| 135 | |
| 136 | powershell := &cobra.Command{ |
| 137 | Use: "powershell", |
| 138 | Short: "generate autocompletion script for powershell", |
| 139 | Long: powershellCompDesc, |
| 140 | Args: require.NoArgs, |
| 141 | ValidArgsFunction: noMoreArgsCompFunc, |
| 142 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 143 | return runCompletionPowershell(out, cmd) |
| 144 | }, |
| 145 | } |
| 146 | powershell.Flags().BoolVar(&disableCompDescriptions, noDescFlagName, false, noDescFlagText) |
| 147 | |
| 148 | cmd.AddCommand(bash, zsh, fish, powershell) |
| 149 |
no test coverage detected
searching dependent graphs…