feat various: fzf, formatting, dependencies script
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
local M = {}
|
||||
|
||||
cmdsList = nil
|
||||
|
||||
function M.checkCommand(cmd, desc)
|
||||
local toRun = ""
|
||||
|
||||
if IS_UNIX then
|
||||
toRun = "command -v " .. cmd
|
||||
else
|
||||
toRun = "where " .. cmd
|
||||
end
|
||||
|
||||
local p = io.popen(toRun)
|
||||
local output = p:read("*l")
|
||||
p:close()
|
||||
|
||||
if output == nil and desc ~= nil and desc ~= "" then
|
||||
print(cmd .. " [" .. desc .. "] - not found!")
|
||||
elseif output == nil then
|
||||
print(cmd .. " - not found!")
|
||||
else
|
||||
print(cmd .. " - ok")
|
||||
end
|
||||
end
|
||||
|
||||
function M.run()
|
||||
for i, cmd in ipairs(cmdsList) do
|
||||
M.checkCommand(cmd.cmd, cmd.desc)
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(cmds)
|
||||
IS_UNIX = package.config:sub(1, 1) ~= "\\"
|
||||
cmdsList = cmds
|
||||
vim.api.nvim_create_user_command("DependenciesCheck", M.run, {})
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user