commandByName returns the registered command for a slash name, or nil. Centralises the linear scan shared by completion, dispatch, and runSlash.
(name string)
| 71 | // commandByName returns the registered command for a slash name, or nil. |
| 72 | // Centralises the linear scan shared by completion, dispatch, and runSlash. |
| 73 | func commandByName(name string) *command { |
| 74 | for i := range commands { |
| 75 | if commands[i].name == name { |
| 76 | return &commands[i] |
| 77 | } |
| 78 | } |
| 79 | return nil |
| 80 | } |
| 81 | |
| 82 | // runSlash dispatches a slash-prefixed submission; unknown commands produce a |
| 83 | // quiet hint, not an error. config.yaml is re-read before every slash so |
no outgoing calls
no test coverage detected