#pragma once #include #include #include #include #include #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; std::shared_ptr get_client() const; std::shared_ptr get_proxy_client() const; }; const char* name; const char* help_text; asio::awaitable> (*run)(Args&); static std::vector commands_by_order; static std::unordered_map commands_by_name; ShellCommand(const char* name, const char* help_text, asio::awaitable> (*run)(Args&)); static asio::awaitable> dispatch_str(std::shared_ptr s, const std::string& command); static asio::awaitable> dispatch(Args& args); };