mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +01:00
feat: added start/available/invite commands
This commit is contained in:
parent
0da26b0639
commit
75e763711f
2 changed files with 29 additions and 0 deletions
|
@ -34,6 +34,9 @@ once connected, more commands become available:
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `:MP disconnect` | disconnects from server |
|
| `:MP disconnect` | disconnects from server |
|
||||||
| `:MP id` | shows current client id |
|
| `:MP id` | shows current client id |
|
||||||
|
| `:MP start <workspace>` | will create a new workspace with given name |
|
||||||
|
| `:MP invite <user> [workspace]` | invite given user to workspace |
|
||||||
|
| `:MP available` | list all workspaces available to join |
|
||||||
| `:MP join <workspace>` | will join requested workspace; starts processing cursors, users and filetree |
|
| `:MP join <workspace>` | will join requested workspace; starts processing cursors, users and filetree |
|
||||||
|
|
||||||
after a workspace is joined, more commands become available:
|
after a workspace is joined, more commands become available:
|
||||||
|
|
|
@ -44,6 +44,32 @@ local connected_actions = {
|
||||||
print(" >< joined workspace " .. ws)
|
print(" >< joined workspace " .. ws)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
start = function(ws)
|
||||||
|
if ws == nil then error("missing workspace name") end
|
||||||
|
state.client:create_workspace(ws):await()
|
||||||
|
print(" <> created workspace " .. ws)
|
||||||
|
end,
|
||||||
|
|
||||||
|
available = function()
|
||||||
|
for _, ws in ipairs(state.client:list_workspaces(true, false):await()) do
|
||||||
|
print(" ++ " .. ws)
|
||||||
|
end
|
||||||
|
for _, ws in ipairs(state.client:list_workspaces(false, true):await()) do
|
||||||
|
print(" -- " .. ws)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
invite = function(user)
|
||||||
|
local ws
|
||||||
|
if state.workspace ~= nil then
|
||||||
|
ws = state.workspace
|
||||||
|
else
|
||||||
|
ws = vim.fn.input("workspace > ", "")
|
||||||
|
end
|
||||||
|
state.client:invite_to_workspace(ws, user):await()
|
||||||
|
print(" ][ invited " .. user .. " to workspace " .. ws)
|
||||||
|
end,
|
||||||
|
|
||||||
disconnect = function()
|
disconnect = function()
|
||||||
print(" xx disconnecting client " .. state.client.id)
|
print(" xx disconnecting client " .. state.client.id)
|
||||||
state.client = nil -- should drop and thus close everything
|
state.client = nil -- should drop and thus close everything
|
||||||
|
|
Loading…
Reference in a new issue