Skip to content

Commit

Permalink
feat: add new command to from current entry to end
Browse files Browse the repository at this point in the history
  • Loading branch information
jellydn committed Oct 22, 2024
1 parent 807b6ff commit 3b81a31
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lua/hurl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,24 @@ function M.setup()
nargs = '*',
range = true,
})

-- Run from current line/entry to end of file
utils.create_cmd('HurlRunnerToEnd', function(opts)
local is_support_hurl = utils.is_nightly() or utils.is_hurl_parser_available
local result = is_support_hurl and http.find_hurl_entry_positions_in_buffer()
or http.find_http_verb_positions_in_buffer()
if result.current > 0 and result.start_line and result.end_line then
utils.log_info(
'hurl: running request at line ' .. result.start_line .. ' to ' .. result.end_line
)
opts.fargs = opts.fargs or {}
local end_line = vim.api.nvim_buf_line_count(0)
run_at_lines(result.start_line, end_line, opts.fargs)
else
utils.log_info('hurl: no HTTP method found in the current line')
utils.notify('hurl: no HTTP method found in the current line', vim.log.levels.INFO)
end
end, { nargs = '*', range = true })
end

return M

0 comments on commit 3b81a31

Please sign in to comment.