Skip to content

Commit

Permalink
Update lua/hurl/lib/hurl_parser.lua
Browse files Browse the repository at this point in the history
Enhance return value with useful metadata.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
jellydn and coderabbitai[bot] authored Nov 1, 2024
1 parent e069d31 commit a4e87ef
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lua/hurl/lib/hurl_parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,24 @@ function M.parse_hurl_output(stderr, stdout)
end
end

return { entries = entries }
local successful = 0
local failed = 0
for _, entry in ipairs(entries) do
if entry.error then
failed = failed + 1
else
successful = successful + 1
end
end

return {
entries = entries,
metadata = {
total = #entries,
successful = successful,
failed = failed
}
}
end

return M

0 comments on commit a4e87ef

Please sign in to comment.