| 48 | }; |
| 49 | |
| 50 | CommandExecutionResult executeTestCommand(std::string_view commandLine) { |
| 51 | auto& registrar = CommandRegistrar::getServerInstance(); |
| 52 | ServerCommandOrigin origin("test", ll::service::getLevel()->asServer(), CommandPermissionLevel::Owner, 0); |
| 53 | |
| 54 | CommandExecutionResult result; |
| 55 | auto compiled = registrar.compileCommand(commandLine, origin); |
| 56 | if (!compiled) { |
| 57 | compiled.error().log(result.output); |
| 58 | compiled.error().log(ll::getLogger()); |
| 59 | return result; |
| 60 | } |
| 61 | |
| 62 | result.compiledCommand = std::move(compiled.value()); |
| 63 | result.compiledCommand->run(origin, result.output); |
| 64 | return result; |
| 65 | } |
| 66 | |
| 67 | } // namespace |
| 68 | |