#pragma once #include #include #include #include #include "config.h" #include "third-party/replxx/include/replxx.hxx" namespace REPL { struct StartupFile { std::vector run_before_listen = {}; std::vector run_after_listen = {}; }; class Wrapper { public: std::string username; Config repl_config; StartupFile startup_file; bool nrepl_alive = false; std::vector examples{}; std::vector> regex_colors{}; Wrapper(GameVersion version) : repl_config(version) {} Wrapper(const std::string& _username, const Config& config, const StartupFile& startup, bool _nrepl_alive) : username(_username), repl_config(config), startup_file(startup), nrepl_alive(_nrepl_alive) {} replxx::Replxx& get_repl() { return repl; } void init_settings(); void reload_startup_file(); // Functionality / Commands void clear_screen(); void print_to_repl(const std::string& str); void print_welcome_message(const std::vector& loaded_projects); void set_history_max_size(size_t len); const char* readline(const std::string& prompt); void add_to_history(const std::string& line); void save_history(); void load_history(); void print_help_message(); void print_keybind_help(); std::pair get_current_repl_token(std::string const& context); private: replxx::Replxx repl; replxx::Replxx::key_press_handler_t commit_text_action(std::string text_to_commit); std::vector keybindings = {}; }; std::string find_repl_username(); StartupFile load_user_startup_file(const std::string& username, const GameVersion game_version); REPL::Config load_repl_config(const std::string& username, const GameVersion game_version, const int nrepl_port); } // namespace REPL