#pragma once #include #include #include #include namespace dragonx { namespace ui { struct ConsoleCompletionResult { std::vector matches; std::string commonPrefix; }; struct ConsoleRpcCall { bool valid = false; std::string method; nlohmann::json params = nlohmann::json::array(); }; enum class ConsoleResultLineRole { Result, Error, JsonKey, JsonString, JsonNumber, JsonBrace }; struct ConsoleResultLine { std::string text; ConsoleResultLineRole role = ConsoleResultLineRole::Result; }; const std::vector& ConsoleRpcCommandNames(); void AppendConsoleHistory(std::vector& history, const std::string& command, std::size_t maxEntries = 100); int NavigateConsoleHistoryIndex(int currentIndex, std::size_t historySize, bool up); std::string ConsoleHistoryEntry(const std::vector& history, int historyIndex); ConsoleCompletionResult CompleteConsoleCommand(const std::string& input); std::vector FormatConsoleCompletionLines(const std::vector& matches, std::size_t maxLineLength = 60); std::vector ParseConsoleCommandArgs(const std::string& command); ConsoleRpcCall BuildConsoleRpcCall(const std::string& command); std::vector FormatConsoleRpcResultLines(const std::string& result, bool isError); } // namespace ui } // namespace dragonx