File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,16 @@ func NewList() *cobra.Command {
3838 DisableAutoGenTag : true ,
3939 }
4040
41+ flags := c .Flags ()
42+ flags .Bool ("all" , false , "List all actions, including those disabled by default" )
43+
4144 c .RunE = func (c * cobra.Command , args []string ) error {
4245
46+ all , err := flags .GetBool ("all" )
47+ if err != nil {
48+ return err
49+ }
50+
4351 var evts map [string ]events.Action
4452 if len (args ) == 0 {
4553 evts = events .All ()
@@ -54,15 +62,20 @@ func NewList() *cobra.Command {
5462 if len (evts ) == 0 {
5563 return fmt .Errorf (`no events matching '%s'` , args [0 ])
5664 }
57-
5865 }
5966
60- actions := make ([]string , len (evts ))
61- i := 0
67+ var actions []string
6268 for action := range evts {
63- actions [i ] = action
64- i ++
69+ if ! all && events .Disabled (action ) {
70+ continue
71+ }
72+ actions = append (actions , action )
73+ }
74+
75+ if len (actions ) == 0 {
76+ return fmt .Errorf (`no enabled events matching '%s'` , args [0 ])
6577 }
78+
6679 sort .Strings (actions )
6780
6881 for _ , v := range actions {
You can’t perform that action at this time.
0 commit comments