This commit is contained in:
MarcHamamji
2023-04-05 13:40:43 +03:00
parent ce9ccbb77d
commit 8c1ed78cbf
8 changed files with 195 additions and 193 deletions

View File

@@ -1,26 +1,26 @@
local helpers = require('runner.handlers.helpers')
local utils = require('runner.handlers.utils')
local helpers = require("runner.handlers.helpers")
local utils = require("runner.handlers.utils")
return function(buffer)
utils.run_command(utils.script_path() .. 'get-scripts.sh', function(output)
local bins = {}
utils.run_command(utils.script_path() .. "get-scripts.sh", function(output)
local bins = {}
for _, line in pairs(output) do
for _, data in pairs(line) do
if vim.trim(data) ~= '' then
bins[#bins + 1] = data
end
end
end
for _, line in pairs(output) do
for _, data in pairs(line) do
if vim.trim(data) ~= "" then
bins[#bins + 1] = data
end
end
end
local handlers = {
['Run current file'] = helpers.shell_handler('node ' .. vim.fn.expand('%'))
}
local handlers = {
["Run current file"] = helpers.shell_handler("node " .. vim.fn.expand("%")),
}
for _, bin in pairs(bins) do
handlers['Run "' .. bin .. '"'] = helpers.shell_handler('npm run ' .. bin)
end
for _, bin in pairs(bins) do
handlers['Run "' .. bin .. '"'] = helpers.shell_handler("npm run " .. bin)
end
helpers.choice(handlers)(buffer)
end)
helpers.choice(handlers)(buffer)
end)
end