| 15 | } |
| 16 | |
| 17 | func doRun() { |
| 18 | for { |
| 19 | read_line, err := reader.ReadString('\n') |
| 20 | if err != nil { |
| 21 | break |
| 22 | } |
| 23 | |
| 24 | read_line = strings.TrimSuffix(read_line[:len(read_line)-1], "\r") |
| 25 | contents := strings.Fields(read_line) |
| 26 | |
| 27 | if len(contents) < 2 { |
| 28 | continue |
| 29 | } |
| 30 | |
| 31 | module_name := contents[0] |
| 32 | command := contents[1] |
| 33 | args_strings := contents[2:] |
| 34 | args := make([]interface{}, len(args_strings)) |
| 35 | for k, v := range args_strings { |
| 36 | args[k] = v |
| 37 | } |
| 38 | m := module.FindModule(module_name) |
| 39 | if m != nil { |
| 40 | m.RpcCall(command, args...) |
| 41 | } else { |
| 42 | slog.LogWarning("console", "module [%v] not found!", module_name) |
| 43 | } |
| 44 | } |
| 45 | } |