3rd party Neovim plugin that compliments https://mise.jdx.dev/

fix: better message when mise has an error / warning

Changed files
+10 -3
lua
mise
+2 -1
README.md
··· 17 Defaults 18 ```lua 19 { 20 - -- Executable to run and the args to pass 21 run = 'mise', 22 args = 'env --json', 23 -- Set to override the base PATH 24 initial_path = vim.env.PATH,
··· 17 Defaults 18 ```lua 19 { 20 + -- Executable to run 21 run = 'mise', 22 + -- Args for the executable, set to "env --json --quiet" to ignore mise warnings 23 args = 'env --json', 24 -- Set to override the base PATH 25 initial_path = vim.env.PATH,
+8 -2
lua/mise/init.lua
··· 32 local full_command = options.run .. " " .. options.args 33 local env_sh = vim.fn.system(full_command) 34 35 local ok, data = pcall(vim.json.decode, env_sh) 36 if not ok or data == nil then 37 log.error('Invalid json returned by "' .. full_command .. '"') ··· 92 set_previous(data) 93 end 94 95 - 96 local group = vim.api.nvim_create_augroup("mise.nvim", { clear = true }) 97 vim.api.nvim_create_autocmd("DirChanged", { 98 group = group, ··· 105 }) 106 107 vim.api.nvim_create_user_command("Mise", function() 108 - log.info(vim.inspect(get_data())); 109 end, { 110 desc = "Mise", 111 })
··· 32 local full_command = options.run .. " " .. options.args 33 local env_sh = vim.fn.system(full_command) 34 35 + -- mise will print out warnings: "mise WARN" without the "--quiet" flag 36 + if string.find(env_sh, "^mise") then 37 + local first_line = string.match(env_sh, "^[^\n]*") 38 + log.error(first_line) 39 + return nil 40 + end 41 + 42 local ok, data = pcall(vim.json.decode, env_sh) 43 if not ok or data == nil then 44 log.error('Invalid json returned by "' .. full_command .. '"') ··· 99 set_previous(data) 100 end 101 102 local group = vim.api.nvim_create_augroup("mise.nvim", { clear = true }) 103 vim.api.nvim_create_autocmd("DirChanged", { 104 group = group, ··· 111 }) 112 113 vim.api.nvim_create_user_command("Mise", function() 114 + log.info(vim.inspect(get_data())) 115 end, { 116 desc = "Mise", 117 })