feat(ui): :connect command #34586

Add the `:connect <address>` command which connects the currently
running TUI to the server at the given address.
This commit is contained in:
Siddhant Agarwal
2025-08-15 04:28:09 +05:30
committed by GitHub
parent bd45e2be63
commit 649bb372f6
9 changed files with 218 additions and 3 deletions

View File

@@ -319,6 +319,20 @@ bool remote_ui_restart(uint64_t channel_id, Error *err)
return true;
}
// Send a connect UI event to the UI on the given channel
void remote_ui_connect(uint64_t channel_id, char *server_addr, Error *err)
{
RemoteUI *ui = get_ui_or_err(channel_id, err);
if (!ui) {
return;
}
MAXSIZE_TEMP_ARRAY(args, 1);
ADD_C(args, CSTR_AS_OBJ(server_addr));
push_call(ui, "connect", args);
}
// TODO(bfredl): use me to detach a specific ui from the server
void remote_ui_stop(RemoteUI *ui)
{

View File

@@ -27,6 +27,8 @@ void visual_bell(void)
FUNC_API_SINCE(3);
void flush(void)
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL;
void connect(Array args)
FUNC_API_SINCE(14) FUNC_API_REMOTE_ONLY FUNC_API_REMOTE_IMPL FUNC_API_CLIENT_IMPL;
void restart(String progpath, Array argv)
FUNC_API_SINCE(14) FUNC_API_REMOTE_ONLY FUNC_API_REMOTE_IMPL FUNC_API_CLIENT_IMPL;
void suspend(void)