2024-08-24 01:57:00 +02:00
|
|
|
local workspace = require("codemp.workspace")
|
|
|
|
|
2024-09-16 18:27:23 +02:00
|
|
|
local function connect()
|
2024-09-17 17:26:23 +02:00
|
|
|
---@type Config
|
|
|
|
local tmp_cfg = vim.tbl_extend('force', {}, CODEMP.config)
|
2024-09-17 17:50:58 +02:00
|
|
|
if tmp_cfg.username == nil or #tmp_cfg.username == 0 then
|
2024-09-17 17:26:23 +02:00
|
|
|
tmp_cfg.username = vim.g.codemp_username or vim.fn.input("username > ", "")
|
2024-09-16 18:27:23 +02:00
|
|
|
end
|
2024-09-17 17:50:58 +02:00
|
|
|
if tmp_cfg.password == nil or #tmp_cfg.password == 0 then
|
2024-09-17 17:26:23 +02:00
|
|
|
tmp_cfg.password = vim.g.codemp_password or vim.fn.input("password > ", "")
|
2024-09-16 18:27:23 +02:00
|
|
|
end
|
2024-09-17 17:58:32 +02:00
|
|
|
print(" -- connecting ...")
|
2024-09-17 17:26:23 +02:00
|
|
|
CODEMP.native.connect(tmp_cfg):and_then(function (client)
|
2024-09-17 17:50:58 +02:00
|
|
|
print(" ++ connected")
|
2024-09-17 17:26:23 +02:00
|
|
|
CODEMP.client = client
|
2024-09-17 16:33:22 +02:00
|
|
|
require('codemp.window').update()
|
|
|
|
workspace.list()
|
|
|
|
end)
|
2024-08-24 01:57:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
connect = connect
|
|
|
|
}
|