@@ -95,6 +95,10 @@ func TestBashCompletions(t *testing.T) {
95
95
rootCmd .Flags ().String ("theme" , "" , "theme to use (located in /themes/THEMENAME/)" )
96
96
rootCmd .Flags ().SetAnnotation ("theme" , BashCompSubdirsInDir , []string {"themes" })
97
97
98
+ // For two word flags check
99
+ rootCmd .Flags ().StringP ("two" , "t" , "" , "this is two word flags" )
100
+ rootCmd .Flags ().BoolP ("two-w-default" , "T" , false , "this is not two word flags" )
101
+
98
102
echoCmd := & Command {
99
103
Use : "echo [string to echo]" ,
100
104
Aliases : []string {"say" },
@@ -183,6 +187,12 @@ func TestBashCompletions(t *testing.T) {
183
187
// check for subdirs_in_dir flags in a subcommand
184
188
checkRegex (t , output , fmt .Sprintf (`_root_echo\(\)\n{[^}]*flags_completion\+=\("__%s_handle_subdirs_in_dir_flag config"\)` , rootCmd .Name ()))
185
189
190
+ // check two word flags
191
+ check (t , output , `two_word_flags+=("--two")` )
192
+ check (t , output , `two_word_flags+=("-t")` )
193
+ checkOmit (t , output , `two_word_flags+=("--two-w-default")` )
194
+ checkOmit (t , output , `two_word_flags+=("-T")` )
195
+
186
196
checkOmit (t , output , deprecatedCmd .Name ())
187
197
188
198
// If available, run shellcheck against the script.
0 commit comments