Skip to content

Commit ec77abc

Browse files
committed
refactor: inline the helper function
1 parent acc00f2 commit ec77abc

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

lua/neogit/lib/finder.lua

+5-14
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,6 @@ local function entries_to_snack_items(entries)
156156
return items
157157
end
158158

159-
---Convert snack picker items to entries
160-
---@param items any[]
161-
---@return any[]
162-
local function snack_items_to_entries(items)
163-
local entries = {}
164-
for _, item in ipairs(items) do
165-
table.insert(entries, item.text)
166-
end
167-
return entries
168-
end
169-
170159
--- Utility function to map actions
171160
---@param on_select fun(item: any|nil)
172161
---@param allow_multi boolean
@@ -180,11 +169,13 @@ local function snacks_actions(on_select, allow_multi, refocus_status)
180169
end
181170

182171
local function confirm(picker, item)
183-
local selection
172+
local selection = {}
184173
local picker_selected = picker:selected { fallback = true }
185174

186175
if #picker_selected > 1 then
187-
selection = snack_items_to_entries(picker_selected)
176+
for _, item in ipairs(picker_selected) do
177+
table.insert(selection, item.text)
178+
end
188179
else
189180
local entry = item.text
190181
local prompt = picker:filter().pattern
@@ -195,7 +186,7 @@ local function snacks_actions(on_select, allow_multi, refocus_status)
195186
or prompt:match("@")
196187
or prompt:match(":")
197188

198-
selection = { (navigate_up_level or input_git_refspec) and prompt or entry }
189+
table.insert(selection, (navigate_up_level or input_git_refspec) and prompt or entry)
199190
end
200191

201192
if selection and selection[1] and selection[1] ~= "" then

0 commit comments

Comments
 (0)