Skip to content

Commit

Permalink
Merge main into sweep/update-comments-docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Oct 31, 2023
2 parents 5469224 + cd7fa1c commit e5f03a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ Check out the following demos to see `hurl.nvim` in action:

### Run a File

Run the entire file by pressing `<leader>A` or run 'HurlRunner' command.
Run the entire file by pressing `<leader>A` or run `HurlRunner` command.

[![Run a file](https://i.gyazo.com/e554e81788aad910848ff991c9369d7b.gif)](https://gyazo.com/e554e81788aad910848ff991c9369d7b)

### Run a Selection

Select a range of lines and press `<leader>h` to execute the request or run 'HurlRunner' command.
Select a range of lines and press `<leader>h` to execute the request or run `HurlRunner` command.

[![Selection](https://i.gyazo.com/1a44dbbf165006fb5744c8f10883bb69.gif)](https://gyazo.com/1a44dbbf165006fb5744c8f10883bb69)

### Run at current line

Place your cursor on the line you want to run and press `<leader>a` or run 'HurlRunnerAt' command to execute the request. It need be one of the HTTP methods listed: GET, POST, PUT, DELETE, PATCH.
Place your cursor on the line you want to run and press `<leader>a` or run `HurlRunnerAt` command to execute the request. It need be one of the HTTP methods listed: GET, POST, PUT, DELETE, PATCH.

[![Run at current line](https://i.gyazo.com/20efd2cf3f73238bd57e79fc662208b1.gif)](https://gyazo.com/20efd2cf3f73238bd57e79fc662208b1)

Expand Down
1 change: 1 addition & 0 deletions lua/hurl/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
local default_config = {
debug = false,
mode = 'split',
env_file = 'vars.env',
formatters = {
json = { 'jq' },
html = {
Expand Down
14 changes: 10 additions & 4 deletions lua/hurl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ local function get_env_file_in_folders()
local root_dir = vim.fn.expand('%:p:h')
local cache_dir = vim.fn.stdpath('cache')
local env_files = {
{ path = root_dir .. '/vars.env', dest = cache_dir .. '/vars.env' },
{
path = root_dir .. '/' .. _HURL_GLOBAL_CONFIG.env_file,
dest = cache_dir .. '/' .. _HURL_GLOBAL_CONFIG.env_file,
},
}
local scan_dir = {
{
Expand All @@ -38,7 +41,10 @@ local function get_env_file_in_folders()
for _, s in ipairs(scan_dir) do
local dir = root_dir .. s.dir
if vim.fn.isdirectory(dir) == 1 then
table.insert(env_files, { path = dir .. '/vars.env', dest = cache_dir .. '/vars.env' })
table.insert(env_files, {
path = dir .. '/' .. _HURL_GLOBAL_CONFIG.env_file,
dest = cache_dir .. '/' .. _HURL_GLOBAL_CONFIG.env_file,
})
end
end

Expand Down Expand Up @@ -112,7 +118,7 @@ local function request(opts, callback)
local env_files = get_env_file_in_folders()
for _, env in ipairs(env_files) do
if vim.fn.filereadable(env.path) == 1 then
utils.log_info('hurl: found vars.env ' .. env.path)
utils.log_info('hurl: found ' .. _HURL_GLOBAL_CONFIG.env_file .. ' in ' .. env.path)
table.insert(opts, '--variables-file')
table.insert(opts, env.path)
break
Expand Down Expand Up @@ -278,7 +284,7 @@ function M.setup()
opts.fargs = vim.list_extend(opts.fargs, { '--to-entry', result.current })
run_current_file(opts.fargs)
else
vim.notify('hurl: no http method found in the current line', vim.log.levels.INFO)
vim.notify('hurl: no HTTP method found in the current line', vim.log.levels.INFO)
end
end, { nargs = '*', range = true })
end
Expand Down

0 comments on commit e5f03a8

Please sign in to comment.