Skip to content

Commit 7f8a8f4

Browse files
committed
stylua
1 parent f7f166a commit 7f8a8f4

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

lua/rest-nvim/curl/init.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local config = require("rest-nvim.config")
55
local M = {}
66
-- get_or_create_buf checks if there is already a buffer with the rest run results
77
-- and if the buffer does not exists, then create a new one
8-
M.get_or_create_buf = function ()
8+
M.get_or_create_buf = function()
99
local tmp_name = "rest_nvim_results"
1010

1111
-- Check if the file is already loaded in the buffer
@@ -39,11 +39,10 @@ M.get_or_create_buf = function ()
3939
return new_bufnr
4040
end
4141

42-
4342
-- curl_cmd runs curl with the passed options, gets or creates a new buffer
4443
-- and then the results are printed to the recently obtained/created buffer
4544
-- @param opts curl arguments
46-
M.curl_cmd = function (opts)
45+
M.curl_cmd = function(opts)
4746
local res = curl[opts.method](opts)
4847
if opts.dry_run then
4948
print("[rest.nvim] Request preview:\n" .. "curl " .. table.concat(res, " "))

lua/rest-nvim/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ rest.run = function(verbose)
3131
dry_run = verbose or false,
3232
}
3333

34-
local success_req, req_err = pcall(curl.curl_cmd,LastOpts)
34+
local success_req, req_err = pcall(curl.curl_cmd, LastOpts)
3535

3636
if not success_req then
3737
vim.api.nvim_err_writeln(

lua/rest-nvim/request/init.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ local utils = require("rest-nvim.utils")
22
local path = require("plenary.path")
33
local log = require("plenary.log").new({ plugin = "rest.nvim", level = "warn" })
44

5-
65
-- get_importfile returns in case of an imported file the absolute filename
76
-- @param bufnr Buffer number, a.k.a id
87
-- @param stop_line Line to stop searching
@@ -19,11 +18,13 @@ local function get_importfile_name(bufnr, start_line, stop_line)
1918
local fileimport_string
2019
local fileimport_line
2120
fileimport_line = vim.api.nvim_buf_get_lines(bufnr, import_line - 1, import_line, false)
22-
fileimport_string = string.gsub(fileimport_line[1], "<", "", 1):gsub("^%s+", ""):gsub("%s+$", "")
21+
fileimport_string = string.gsub(fileimport_line[1], "<", "", 1)
22+
:gsub("^%s+", "")
23+
:gsub("%s+$", "")
2324
-- local fileimport_path = path:new(fileimport_string)
2425
-- if fileimport_path:is_absolute() then
2526
if path:new(fileimport_string):is_absolute() then
26-
return fileimport_string
27+
return fileimport_string
2728
else
2829
local file_dirname = vim.fn.expand("%:p:h")
2930
local file_name = path:new(path:new(file_dirname), fileimport_string)
@@ -49,7 +50,7 @@ local function get_body(bufnr, start_line, stop_line)
4950
local lines
5051
if importfile ~= nil then
5152
if not utils.file_exists(importfile) then
52-
error("import file " .. importfile .. " not found")
53+
error("import file " .. importfile .. " not found")
5354
end
5455
lines = utils.read_file(importfile)
5556
else
@@ -115,7 +116,6 @@ local function get_headers(bufnr, start_line, end_line)
115116
return headers, body_start
116117
end
117118

118-
119119
-- start_request will find the request line (e.g. POST http://localhost:8081/foo)
120120
-- of the current request and returns the linenumber of this request line.
121121
-- The current request is defined as the next request line above the cursor
@@ -176,11 +176,11 @@ M.get_current_request = function()
176176
local body = get_body(bufnr, body_start, end_line)
177177

178178
return {
179-
method = parsed_url.method,
180-
url = parsed_url.url,
181-
headers = headers,
182-
body = body,
183-
}
179+
method = parsed_url.method,
180+
url = parsed_url.url,
181+
headers = headers,
182+
body = body,
183+
}
184184
end
185185

186186
return M

lua/rest-nvim/utils/init.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local M = {}
66
-- go_to_line moves the cursor to the desired line in the provided buffer
77
-- @param bufnr Buffer number, a.k.a id
88
-- @param line the desired cursor position
9-
M.go_to_line = function (bufnr, line)
9+
M.go_to_line = function(bufnr, line)
1010
vim.api.nvim_buf_call(bufnr, function()
1111
vim.fn.cursor(line, 1)
1212
end)
@@ -33,7 +33,9 @@ end
3333
-- read_file Reads all lines from a file and returns the content as a table
3434
-- returns empty table if file does not exist
3535
M.read_file = function(file)
36-
if not M.file_exists(file) then return {} end
36+
if not M.file_exists(file) then
37+
return {}
38+
end
3739
local lines = {}
3840
for line in io.lines(file) do
3941
lines[#lines + 1] = line

0 commit comments

Comments
 (0)