From 5193456238c5ef4629346f98c84b4459b6f017cf Mon Sep 17 00:00:00 2001 From: Michal Vyskocil Date: Thu, 12 Sep 2024 19:37:41 +0200 Subject: [PATCH] fix(from_curl): improve heuristic and recognize curl_path too --- lua/kulala/parser/curl.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/kulala/parser/curl.lua b/lua/kulala/parser/curl.lua index 1adf729..4059bd7 100644 --- a/lua/kulala/parser/curl.lua +++ b/lua/kulala/parser/curl.lua @@ -1,3 +1,4 @@ +local Config = require("kulala.config") local Shlex = require("kulala.lib.shlex") local Stringutils = require("kulala.utils.string") @@ -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 = {