#pragma once #include #include #include #include #include #include "ProxyServer.hh" #include "ServerState.hh" class exit_shell : public std::runtime_error { public: exit_shell(); ~exit_shell() = default; }; struct ShellCommand { struct Args { std::shared_ptr s; std::string command; std::string args; std::string session_name; }; const char* name; const char* help_text; bool run_on_event_thread; std::deque (*run)(Args&); static std::vector commands_by_order; static std::unordered_map commands_by_name; ShellCommand(const char* name, const char* help_text, bool run_on_event_thread, std::deque (*run)(Args&)); static std::deque dispatch_str(std::shared_ptr s, const std::string& command); static std::deque dispatch(Args& args); };