Skip to content

Commit d76141b

Browse files
authored
fix(formatter): format optional grep args (#234)
* fix(ui): format optional grep args * refactor: rewrite as vim.iter as tbl_filter + concat
1 parent 0e8c3ca commit d76141b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lua/opencode/ui/formatter.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,12 @@ end
560560
---@param input GrepToolInput data for the tool
561561
---@param metadata GrepToolMetadata Metadata for the tool use
562562
function M._format_grep_tool(output, input, metadata)
563-
input = input or { path = '', include = '', pattern = '' }
564-
565-
local grep_str = string.format('%s` `%s', (input.path or input.include) or '', input.pattern or '')
563+
local grep_str = table.concat(
564+
vim.tbl_filter(function(part)
565+
return part ~= nil
566+
end, { input.path or input.include, input.pattern }),
567+
'` `'
568+
)
566569

567570
M.format_action(output, icons.get('search') .. ' grep', grep_str)
568571
if not config.ui.output.tools.show_output then

0 commit comments

Comments
 (0)