MapByName returns a [Map] and index by name. It returns false and prints an error message if not found.
(name MapName)
| 275 | // MapByName returns a [Map] and index by name. It returns false |
| 276 | // and prints an error message if not found. |
| 277 | func (km *Maps) MapByName(name MapName) (*Map, int, bool) { |
| 278 | for i, it := range *km { |
| 279 | if it.Name == string(name) { |
| 280 | return &it.Map, i, true |
| 281 | } |
| 282 | } |
| 283 | slog.Error("keymap.KeyMaps.MapByName: key map not found", "name", name) |
| 284 | return nil, -1, false |
| 285 | } |
| 286 | |
| 287 | // CopyFrom copies keymaps from given other map |
| 288 | func (km *Maps) CopyFrom(cp Maps) { |
no test coverage detected