From 718562de8fa92670410f15dbca0949491b742d81 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:33:56 +0000 Subject: [PATCH] feat: Updated lua/hurl/main.lua --- lua/hurl/main.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lua/hurl/main.lua b/lua/hurl/main.lua index cf55ad8..9cf07a4 100644 --- a/lua/hurl/main.lua +++ b/lua/hurl/main.lua @@ -212,6 +212,24 @@ local function execute_hurl_cmd(opts, callback) utils.log_info('hurl: running command' .. vim.inspect(cmd)) + -- Parse [Captures] section and update global variables + if _HURL_GLOBAL_CONFIG.captures then + for capture_name, capture_method in pairs(_HURL_GLOBAL_CONFIG.captures) do + local captured_value = nil -- Placeholder for capture extraction logic + -- TODO: Implement capture extraction logic based on capture_method + + if captured_value then + _HURL_GLOBAL_CONFIG.global_vars = _HURL_GLOBAL_CONFIG.global_vars or {} + _HURL_GLOBAL_CONFIG.global_vars[capture_name] = captured_value + utils.log_info('hurl: captured variable ' .. capture_name .. ' set to ' .. captured_value) + utils.notify('hurl: captured variable ' .. capture_name .. ' set to ' .. captured_value, vim.log.levels.INFO) + else + utils.log_error('hurl: failed to capture variable ' .. capture_name) + utils.notify('hurl: failed to capture variable ' .. capture_name, vim.log.levels.ERROR) + end + end + end + vim.fn.jobstart(cmd, { on_stdout = callback or on_output, on_stderr = callback or on_output,