Skip to content

Commit

Permalink
fix(from_curl): improve heuristic and recognize curl_path too
Browse files Browse the repository at this point in the history
  • Loading branch information
vyskocilm committed Sep 12, 2024
1 parent dd6a549 commit 5193456
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/kulala/parser/curl.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local Config = require("kulala.config")
local Shlex = require("kulala.lib.shlex")
local Stringutils = require("kulala.utils.string")

Expand Down Expand Up @@ -27,9 +28,9 @@ function M.parse(curl)
curl = string.gsub(curl, "%s+", " ")

local parts = Shlex.split(curl)
-- if string doesn't start with curl, return nil
-- if string doesn't start with curl or different from curl_path, return nil
-- it could also be curl-7.68.0 or something like that
if string.find(parts[1], "^curl.*") == nil then
if string.find(parts[1], "^curl.*") == nil and parts[1] ~= Config.get().curl_path then
return nil, nil
end
local res = {
Expand Down

0 comments on commit 5193456

Please sign in to comment.