diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-04 09:49:10 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-04 09:49:10 -0400 |
| commit | 14310ee6b1f40425ba854d6ddc6374960fdf81ca (patch) | |
| tree | c6ea9c7a2acb62f853e91b4d1544b899a8af9f3e /lua/telescope/finders.lua | |
| parent | 996f69465ed51856aa18093d88795fae2b8565f4 (diff) | |
fix: Don't push past midnight. You'll make clason's stuff break :/
Diffstat (limited to 'lua/telescope/finders.lua')
| -rw-r--r-- | lua/telescope/finders.lua | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lua/telescope/finders.lua b/lua/telescope/finders.lua index 7682aeb..3957f26 100644 --- a/lua/telescope/finders.lua +++ b/lua/telescope/finders.lua @@ -46,12 +46,15 @@ function JobFinder:new(opts) -- pipe -- vim.loop.new_pipe (stdin / stdout). stdout => filter pipe -- rg huge_search | fzf --filter prompt_is > buffer. buffer could do stuff do w/ preview callback + local obj = setmetatable({ entry_maker = opts.entry_maker or make_entry.from_string, fn_command = opts.fn_command, static = opts.static, state = {}, + cwd = opts.cwd, + -- Maximum number of results to process. -- Particularly useful for live updating large queries. maximum_results = opts.maximum_results, @@ -113,7 +116,7 @@ function JobFinder:_find(prompt, process_result, process_complete) self.job = Job:new { command = opts.command, args = opts.args, - cwd = opts.cwd, + cwd = opts.cwd or self.cwd, maximum_results = self.maximum_results, @@ -210,8 +213,12 @@ finders.new_job = function(command_generator, entry_maker, maximum_results) end ---@param command_list string[] Command list to execute. ----@param entry_maker function Optional: function(line: string) => table -finders.new_oneshot_job = function(command_list, entry_maker) +---@param opts table +--- @key entry_maker function Optional: function(line: string) => table +--- @key cwd string +finders.new_oneshot_job = function(command_list, opts) + opts = opts or {} + command_list = vim.deepcopy(command_list) local command = table.remove(command_list, 1) @@ -219,7 +226,9 @@ finders.new_oneshot_job = function(command_list, entry_maker) return JobFinder:new { static = true, - entry_maker = entry_maker or make_entry.from_string, + entry_maker = opts.entry_maker or make_entry.gen_from_string, + + cwd = opts.cwd, fn_command = function() return { |
