mirror of
https://github.com/kristoferssolo/runner.nvim.git
synced 2025-10-21 19:50:34 +00:00
Lint
This commit is contained in:
parent
92e206ae85
commit
67e9354280
@ -9,7 +9,7 @@ local defaults = {
|
|||||||
M.options = {}
|
M.options = {}
|
||||||
|
|
||||||
M.setup = function(options)
|
M.setup = function(options)
|
||||||
M.options = vim.tbl_deep_extend("force", {}, defaults, options or {})
|
M.options = vim.tbl_deep_extend('force', {}, defaults, options or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
M.setup()
|
M.setup()
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
local pickers = require("telescope.pickers")
|
local pickers = require('telescope.pickers')
|
||||||
local finders = require("telescope.finders")
|
local finders = require('telescope.finders')
|
||||||
local actions = require("telescope.actions")
|
local actions = require('telescope.actions')
|
||||||
local action_state = require("telescope.actions.state")
|
local action_state = require('telescope.actions.state')
|
||||||
local sorters = require("telescope.sorters")
|
local sorters = require('telescope.sorters')
|
||||||
local themes = require("telescope.themes")
|
local themes = require('telescope.themes')
|
||||||
|
|
||||||
local utils = require("runner.handlers.utils")
|
local utils = require('runner.handlers.utils')
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ M.shell_handler = function(command, editable)
|
|||||||
end
|
end
|
||||||
return function(_)
|
return function(_)
|
||||||
if editable then
|
if editable then
|
||||||
command = vim.fn.input("Command: ", command)
|
command = vim.fn.input('Command: ', command)
|
||||||
end
|
end
|
||||||
|
|
||||||
local output_buffer = utils.create_buffer()
|
local output_buffer = utils.create_buffer()
|
||||||
@ -39,7 +39,7 @@ end
|
|||||||
M.choice = function(handlers)
|
M.choice = function(handlers)
|
||||||
local handlers_count = vim.tbl_count(handlers)
|
local handlers_count = vim.tbl_count(handlers)
|
||||||
if handlers_count == 0 then
|
if handlers_count == 0 then
|
||||||
print("No handler available right now")
|
print('No handler available right now')
|
||||||
return function() end
|
return function() end
|
||||||
elseif handlers_count == 1 then
|
elseif handlers_count == 1 then
|
||||||
return vim.tbl_values(handlers)[1]
|
return vim.tbl_values(handlers)[1]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
local helpers = require("runner.handlers.helpers")
|
local helpers = require('runner.handlers.helpers')
|
||||||
|
|
||||||
local handlers = {
|
local handlers = {
|
||||||
rust = require('runner.handlers.languages.rust'),
|
rust = require('runner.handlers.languages.rust'),
|
||||||
|
|||||||
@ -2,12 +2,12 @@ local helpers = require('runner.handlers.helpers')
|
|||||||
local utils = require('runner.handlers.utils')
|
local utils = require('runner.handlers.utils')
|
||||||
|
|
||||||
return function(buffer)
|
return function(buffer)
|
||||||
utils.run_command(utils.script_path() .. "get-scripts.sh", function(output)
|
utils.run_command(utils.script_path() .. 'get-scripts.sh', function(output)
|
||||||
local bins = {}
|
local bins = {}
|
||||||
|
|
||||||
for _, line in pairs(output) do
|
for _, line in pairs(output) do
|
||||||
for _, data in pairs(line) do
|
for _, data in pairs(line) do
|
||||||
if vim.trim(data) ~= "" then
|
if vim.trim(data) ~= '' then
|
||||||
bins[#bins + 1] = data
|
bins[#bins + 1] = data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -18,7 +18,7 @@ return function(buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, bin in pairs(bins) do
|
for _, bin in pairs(bins) do
|
||||||
handlers['Run "' .. bin .. '"'] = helpers.shell_handler("npm run " .. bin)
|
handlers['Run "' .. bin .. '"'] = helpers.shell_handler('npm run ' .. bin)
|
||||||
end
|
end
|
||||||
|
|
||||||
helpers.choice(handlers)(buffer)
|
helpers.choice(handlers)(buffer)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
local helpers = require("runner.handlers.helpers")
|
local helpers = require('runner.handlers.helpers')
|
||||||
|
|
||||||
return function(buffer)
|
return function(buffer)
|
||||||
helpers.shell_handler("python " .. vim.fn.expand("%"))(buffer)
|
helpers.shell_handler('python ' .. vim.fn.expand('%'))(buffer)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,12 +2,12 @@ local helpers = require('runner.handlers.helpers')
|
|||||||
local utils = require('runner.handlers.utils')
|
local utils = require('runner.handlers.utils')
|
||||||
|
|
||||||
return function(buffer)
|
return function(buffer)
|
||||||
utils.run_command(utils.script_path() .. "get-bins.sh", function(output)
|
utils.run_command(utils.script_path() .. 'get-bins.sh', function(output)
|
||||||
local bins = {}
|
local bins = {}
|
||||||
|
|
||||||
for _, line in pairs(output) do
|
for _, line in pairs(output) do
|
||||||
for _, data in pairs(line) do
|
for _, data in pairs(line) do
|
||||||
if vim.trim(data) ~= "" then
|
if vim.trim(data) ~= '' then
|
||||||
bins[#bins + 1] = data
|
bins[#bins + 1] = data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -16,15 +16,15 @@ return function(buffer)
|
|||||||
local run_handlers = {}
|
local run_handlers = {}
|
||||||
|
|
||||||
for _, bin in pairs(bins) do
|
for _, bin in pairs(bins) do
|
||||||
run_handlers['Run "' .. bin .. '"'] = helpers.shell_handler("cargo run --bin " .. bin)
|
run_handlers['Run "' .. bin .. '"'] = helpers.shell_handler('cargo run --bin ' .. bin)
|
||||||
end
|
end
|
||||||
|
|
||||||
utils.run_command(utils.script_path() .. "get-tests.sh", function(output)
|
utils.run_command(utils.script_path() .. 'get-tests.sh', function(output)
|
||||||
local bins = {}
|
local bins = {}
|
||||||
|
|
||||||
for _, line in pairs(output) do
|
for _, line in pairs(output) do
|
||||||
for _, data in pairs(line) do
|
for _, data in pairs(line) do
|
||||||
if vim.trim(data) ~= "" then
|
if vim.trim(data) ~= '' then
|
||||||
bins[#bins + 1] = data
|
bins[#bins + 1] = data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -32,12 +32,12 @@ return function(buffer)
|
|||||||
|
|
||||||
local handlers = {
|
local handlers = {
|
||||||
unpack(run_handlers),
|
unpack(run_handlers),
|
||||||
["Custom"] = helpers.shell_handler("cargo ", true),
|
['Custom'] = helpers.shell_handler('cargo ', true),
|
||||||
["Test all"] = helpers.shell_handler("cargo test"),
|
['Test all'] = helpers.shell_handler('cargo test'),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, bin in pairs(bins) do
|
for _, bin in pairs(bins) do
|
||||||
handlers['Test "' .. bin .. '"'] = helpers.shell_handler("cargo test --test " .. bin)
|
handlers['Test "' .. bin .. '"'] = helpers.shell_handler('cargo test --test ' .. bin)
|
||||||
end
|
end
|
||||||
|
|
||||||
helpers.choice(handlers)(buffer)
|
helpers.choice(handlers)(buffer)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local config = require("runner.config")
|
local config = require('runner.config')
|
||||||
|
|
||||||
M._buffer = nil
|
M._buffer = nil
|
||||||
M._window = nil
|
M._window = nil
|
||||||
@ -11,7 +11,7 @@ M.create_buffer = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local buffer = vim.api.nvim_create_buf(true, true)
|
local buffer = vim.api.nvim_create_buf(true, true)
|
||||||
vim.api.nvim_buf_set_option(buffer, "modifiable", false)
|
vim.api.nvim_buf_set_option(buffer, 'modifiable', false)
|
||||||
|
|
||||||
M._buffer = buffer
|
M._buffer = buffer
|
||||||
return buffer
|
return buffer
|
||||||
@ -71,22 +71,22 @@ M.run_command = function(command, callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local is_win = function()
|
local is_win = function()
|
||||||
return package.config:sub(1, 1) == "\\"
|
return package.config:sub(1, 1) == '\\'
|
||||||
end
|
end
|
||||||
|
|
||||||
local get_path_separator = function()
|
local get_path_separator = function()
|
||||||
if package.config:sub(1, 1) == "\\" then
|
if package.config:sub(1, 1) == '\\' then
|
||||||
return "\\"
|
return '\\'
|
||||||
end
|
end
|
||||||
return "/"
|
return '/'
|
||||||
end
|
end
|
||||||
|
|
||||||
M.script_path = function()
|
M.script_path = function()
|
||||||
local str = debug.getinfo(2, "S").source:sub(2)
|
local str = debug.getinfo(2, 'S').source:sub(2)
|
||||||
if is_win() then
|
if is_win() then
|
||||||
str = str:gsub("/", "\\")
|
str = str:gsub('/', '\\')
|
||||||
end
|
end
|
||||||
return str:match("(.*" .. get_path_separator() .. ")")
|
return str:match('(.*' .. get_path_separator() .. ')')
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
local handlers = require("runner.handlers")
|
local handlers = require('runner.handlers')
|
||||||
local config = require("runner.config")
|
local config = require('runner.config')
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user