From 917500dbe90b46f13f6d5a69e182e2f663febb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=81uczy=C5=84ski?= Date: Sat, 9 Oct 2021 15:34:08 +0200 Subject: [PATCH] fix: check also fdfind in healthcheck (#1318) Support different binary names when checking if fd is installed. --- lua/telescope/health.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lua/telescope/health.lua b/lua/telescope/health.lua index ece1a63..010755e 100644 --- a/lua/telescope/health.lua +++ b/lua/telescope/health.lua @@ -25,6 +25,7 @@ local optional_dependencies = { package = { { name = "fd", + binaries = { "fd", "fdfind" }, url = "[sharkdp/fd](https://github.com/sharkdp/fd)", optional = true, }, @@ -42,15 +43,17 @@ local required_plugins = { } local check_binary_installed = function(package) - local file_extension = is_win and ".exe" or "" - local filename = package.name .. file_extension - if fn.executable(filename) == 0 then - return - else - local handle = io.popen(filename .. " --version") - local binary_version = handle:read "*a" - handle:close() - return true, binary_version + local binaries = package.binaries or { package.name } + for _, binary in ipairs(binaries) do + if is_win then + binary = binary .. ".exe" + end + if fn.executable(binary) == 1 then + local handle = io.popen(binary .. " --version") + local binary_version = handle:read "*a" + handle:close() + return true, binary_version + end end end