From ea1b27677084ff1f855645269d7cc3b301926a0b Mon Sep 17 00:00:00 2001 From: Marco Kellershoff <1384938+gorillamoe@users.noreply.github.com> Date: Mon, 9 Sep 2024 19:41:58 +0200 Subject: [PATCH] feat(config): make curl path configurable (#226) --- .../getting-started/configuration-options.md | 23 +++++++++++++++++++ lua/kulala/config/init.lua | 4 ++++ lua/kulala/parser/init.lua | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/docs/getting-started/configuration-options.md b/docs/docs/getting-started/configuration-options.md index a65fdfe..4b2d377 100644 --- a/docs/docs/getting-started/configuration-options.md +++ b/docs/docs/getting-started/configuration-options.md @@ -10,6 +10,11 @@ Here is a full example of setting up the Kulala plugin with the available `opts` { "mistweaverco/kulala.nvim", opts = { + -- cURL path + -- if you have curl installed in a non-standard path, + -- you can specify it here + curl_path = "curl", + -- split direction -- possible values: "vertical", "horizontal" split_direction = "vertical", @@ -97,6 +102,24 @@ Here is a full example of setting up the Kulala plugin with the available `opts` } ``` +### curl_path + +cURL path. + +If you have `curl` installed in a non-standard path, you can specify it here. + +Default: `curl` + +Example: + +```lua +{ + "mistweaverco/kulala.nvim", + opts = { + curl_path = "/home/bonobo/.local/bin/curl", + }, +} +``` ### split_direction Split direction. diff --git a/lua/kulala/config/init.lua b/lua/kulala/config/init.lua index 79590b9..9f41dba 100644 --- a/lua/kulala/config/init.lua +++ b/lua/kulala/config/init.lua @@ -2,6 +2,10 @@ local FS = require("kulala.utils.fs") local M = {} M.defaults = { + -- cURL path + -- if you have curl installed in a non-standard path, + -- you can specify it here + curl_path = "curl", -- split direction -- possible values: "vertical", "horizontal" split_direction = "vertical", diff --git a/lua/kulala/parser/init.lua b/lua/kulala/parser/init.lua index e36e89c..495a293 100644 --- a/lua/kulala/parser/init.lua +++ b/lua/kulala/parser/init.lua @@ -543,7 +543,7 @@ function M.parse(start_request_linenr) end -- build the command to exectute the request - table.insert(res.cmd, "curl") + table.insert(res.cmd, CONFIG.get().curl_path) table.insert(res.cmd, "-s") table.insert(res.cmd, "-D") table.insert(res.cmd, PLUGIN_TMP_DIR .. "/headers.txt")