fix: check for nil and empty string

empty string is not falsy in lua? idk
This commit is contained in:
əlemi 2024-09-17 17:50:58 +02:00
parent d524076412
commit 32e056de91
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 3 additions and 3 deletions

View file

@ -3,13 +3,14 @@ local workspace = require("codemp.workspace")
local function connect()
---@type Config
local tmp_cfg = vim.tbl_extend('force', {}, CODEMP.config)
if not tmp_cfg.username then
if tmp_cfg.username == nil or #tmp_cfg.username == 0 then
tmp_cfg.username = vim.g.codemp_username or vim.fn.input("username > ", "")
end
if not tmp_cfg.password then
if tmp_cfg.password == nil or #tmp_cfg.password == 0 then
tmp_cfg.password = vim.g.codemp_password or vim.fn.input("password > ", "")
end
CODEMP.native.connect(tmp_cfg):and_then(function (client)
print(" ++ connected")
CODEMP.client = client
require('codemp.window').update()
workspace.list()

View file

@ -25,7 +25,6 @@ local base_actions = {
connect = function()
client.connect()
print(" ++ connected")
end,
}