fix(highlight): allow override (#201)

update envvar parsing from cmdline

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham
2024-08-24 20:15:45 -04:00
committed by GitHub
parent a7d3defa3d
commit f99bf767b5
8 changed files with 62 additions and 56 deletions

View File

@@ -107,13 +107,8 @@ E.parse_envvar = function(Opts)
local key = nil
if cmd ~= nil then
local ok, job = pcall(vim.system, vim.split(cmd, " ", { trimempty = true }), { text = true })
if not ok then
Utils.error("Failed to execute command to retrieve secrets: " .. cmd, { once = true, title = "Avante" })
else
local out = job:wait()
key = out.stdout
end
local result = vim.system(vim.split(cmd, " ", { trimempty = true }), { text = true }):wait()
key = vim.split(result.stdout, "\n")[1]
else
key = os.getenv(api_key_name)
end