fix: check also fdfind in healthcheck (#1318)
Support different binary names when checking if fd is installed.
This commit is contained in:
@@ -25,6 +25,7 @@ local optional_dependencies = {
|
|||||||
package = {
|
package = {
|
||||||
{
|
{
|
||||||
name = "fd",
|
name = "fd",
|
||||||
|
binaries = { "fd", "fdfind" },
|
||||||
url = "[sharkdp/fd](https://github.com/sharkdp/fd)",
|
url = "[sharkdp/fd](https://github.com/sharkdp/fd)",
|
||||||
optional = true,
|
optional = true,
|
||||||
},
|
},
|
||||||
@@ -42,15 +43,17 @@ local required_plugins = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local check_binary_installed = function(package)
|
local check_binary_installed = function(package)
|
||||||
local file_extension = is_win and ".exe" or ""
|
local binaries = package.binaries or { package.name }
|
||||||
local filename = package.name .. file_extension
|
for _, binary in ipairs(binaries) do
|
||||||
if fn.executable(filename) == 0 then
|
if is_win then
|
||||||
return
|
binary = binary .. ".exe"
|
||||||
else
|
end
|
||||||
local handle = io.popen(filename .. " --version")
|
if fn.executable(binary) == 1 then
|
||||||
local binary_version = handle:read "*a"
|
local handle = io.popen(binary .. " --version")
|
||||||
handle:close()
|
local binary_version = handle:read "*a"
|
||||||
return true, binary_version
|
handle:close()
|
||||||
|
return true, binary_version
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user