Skip to content

Commit

Permalink
Object 94
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jan 3, 2025
1 parent c1e7fb6 commit 756ee33
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
19 changes: 13 additions & 6 deletions lua/fittencode/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,21 @@ local defaults = {
level = vim.log.levels.WARN,
},
http = {
-- cURL implemented
-- backend implemented
-- Avaiable options:
-- * 'curl'
-- * 'libcurl'
curl = 'curl',
curl_path = '',
gzip_path = '',
timeout = 60, -- seconds
-- * 'libcurl' (Only available on Linux)
backend = 'curl',
curl = {
-- Default `curl`
command = '',
timeout = 60, -- seconds
},
gzip = {
-- Default `gzip`
command = '',
},
libcurl = {},
},
chat = {
view = {
Expand Down
4 changes: 2 additions & 2 deletions lua/fittencode/hash/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package.cpath = package.cpath .. ';'.. require('cpath')
package.cpath = package.cpath .. ';' .. require('cpath')

local C = require("hash")
local C = require('hash')

---@class Hash
---@field md5 function
Expand Down
3 changes: 2 additions & 1 deletion lua/fittencode/http/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local Config = require('fittencode.config')
local Fn = require('fittencode.fn')

if Config.http.backend == 'libcurl' then
if Config.http.backend == 'libcurl' and Fn.is_linux() then
return require('fittencode.http.libcurl')
else
return require('fittencode.http.curl')
Expand Down
3 changes: 3 additions & 0 deletions lua/fittencode/http/libcurl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build
cpath.lua
libcurl.so
2 changes: 1 addition & 1 deletion lua/fittencode/http/libcurl/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ local M = {}
function M.fetch(url, options)
end

return M
return M
Empty file.

0 comments on commit 756ee33

Please sign in to comment.