Skip to content

Commit

Permalink
fix(env): early return causing nil env table error
Browse files Browse the repository at this point in the history
  • Loading branch information
caenrique committed Aug 1, 2024
1 parent b10b937 commit cb828db
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/kulala/parser/env.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ M.get_env = function()
elseif dotenv then
local dotenv_env = vim.fn.readfile(dotenv)
for _, line in ipairs(dotenv_env) do
if line:match("^%s*$") or line:match("^%s*#") then
return
end
local key, value = line:match("^%s*([^=]+)%s*=%s*(.*)%s*$")
if key and value then
env[key] = value
-- if the line is not empy and not a comment, then
if not line:match("^%s*$") and not line:match("^%s*#") then
local key, value = line:match("^%s*([^=]+)%s*=%s*(.*)%s*$")
if key and value then
env[key] = value
end
end
end
end
Expand Down

0 comments on commit cb828db

Please sign in to comment.