Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(from_curl): improve heuristic and recognize curl_path too #238

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
gorillamoe marked this conversation as resolved.
Show resolved Hide resolved
return nil, nil
end
local res = {
Expand Down