@@ -24,6 +24,44 @@ func TestAction(t *testing.T) {
2424 Expect (carapace .ActionMessage ("values flag is not set" ).
2525 Usage ("ActionCallback()" ))
2626
27+ s .Run ("action" , "--commands" , "s" ).
28+ Expect (carapace .ActionValuesDescribed (
29+ "special" , "" ,
30+ "subcommand" , "subcommand example" ,
31+ ).Suffix (" " ).
32+ NoSpace ().
33+ Tag ("other commands" ).
34+ Usage ("ActionCommands()" ))
35+
36+ s .Run ("action" , "--commands" , "subcommand " ).
37+ Expect (carapace .Batch (
38+ carapace .ActionValuesDescribed (
39+ "a1" , "subcommand with alias" ,
40+ "a2" , "subcommand with alias" ,
41+ "alias" , "subcommand with alias" ,
42+ ).Tag ("other commands" ),
43+ carapace .ActionValuesDescribed (
44+ "group" , "subcommand with group" ,
45+ ).Style (style .Blue ).Tag ("group commands" ),
46+ ).ToA ().
47+ Prefix ("subcommand " ).
48+ Suffix (" " ).
49+ NoSpace ().
50+ Usage ("ActionCommands()" ))
51+
52+ s .Run ("action" , "--commands" , "subcommand unknown " ).
53+ Expect (carapace .ActionMessage (`unknown subcommand "unknown" for "subcommand"` ).NoSpace ().
54+ Usage ("ActionCommands()" ))
55+
56+ s .Run ("action" , "--commands" , "subcommand hidden " ).
57+ Expect (carapace .ActionValuesDescribed (
58+ "visible" , "visible subcommand of a hidden command" ,
59+ ).Prefix ("subcommand hidden " ).
60+ Suffix (" " ).
61+ NoSpace ().
62+ Tag ("commands" ).
63+ Usage ("ActionCommands()" ))
64+
2765 s .Run ("action" , "--values" , "first" , "--callback" , "" ).
2866 Expect (carapace .ActionMessage ("values flag is set to: 'first'" ).
2967 Usage ("ActionCallback()" ))
0 commit comments