From c2aafde0c80f6902649e7dd98d00ffb1e70e2bce Mon Sep 17 00:00:00 2001 From: themodrnhakr Date: Thu, 2 Oct 2025 16:10:09 -0500 Subject: [PATCH] Add helper function for running jj commands --- lua/jj_mini_diff/init.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/jj_mini_diff/init.lua b/lua/jj_mini_diff/init.lua index 9cc076f..b3f6d01 100644 --- a/lua/jj_mini_diff/init.lua +++ b/lua/jj_mini_diff/init.lua @@ -2,6 +2,21 @@ local M = {} +-- Helper function to run jj commands +local function _run_jj_command(args) + local cmd = "jj " .. table.concat(args, " ") + local handle = io.popen(cmd) + if not handle then + return nil, "Failed to run command: " .. cmd + end + local output = handle:read("*a") + local status = handle:close() + if not status then + return nil, "Command failed: " .. cmd + end + return output +end + function M.setup(opts) opts = opts or {} -- TODO: Implement configuration options