Skip to content

Commit

Permalink
feat: simplify utils/dap.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Jint-lzxy committed Jun 12, 2023
1 parent a474295 commit 1d9381c
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions lua/modules/utils/dap.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
local M = {}

function M.input_args()
return function()
local argument_string = vim.fn.input("Program arg(s) (enter nothing to leave it null): ")
return vim.fn.split(argument_string, " ", true)
end
local argument_string = vim.fn.input("Program arg(s) (enter nothing to leave it null): ")
return vim.fn.split(argument_string, " ", true)
end

function M.input_exec_path()
return function()
return vim.fn.input('Path to executable (default to "progout"): ', vim.fn.getcwd() .. "/progout", "file")
end
return vim.fn.input('Path to executable (default to "progout"): ', vim.fn.getcwd() .. "/progout", "file")
end

function M.get_env()
return function()
local variables = {}
for k, v in pairs(vim.fn.environ()) do
table.insert(variables, string.format("%s=%s", k, v))
end
return variables
local variables = {}
for k, v in pairs(vim.fn.environ()) do
table.insert(variables, string.format("%s=%s", k, v))
end
return variables
end

return M
return setmetatable({}, {
__index = function(_, key)
return function()
return function()
return M[key]()
end
end
end,
})

0 comments on commit 1d9381c

Please sign in to comment.