github.com/starshine-sys/bcr@v0.21.0/help_cmd.go (about) 1 package bcr 2 3 import ( 4 "github.com/starshine-sys/snowflake/v2" 5 ) 6 7 // Commands returns a list of commands 8 func (r *Router) Commands() []*Command { 9 // deduplicate commands 10 sf := make([]snowflake.Snowflake, 0) 11 cmds := make([]*Command, 0) 12 for _, c := range r.cmds { 13 if !snowflakeInSlice(c.id, sf) && !c.Hidden { 14 sf = append(sf, c.id) 15 cmds = append(cmds, c) 16 } 17 } 18 19 return cmds 20 }