mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-15 23:53:18 +00:00
refactor!: Migrate runners cmd from string to argv (#134)
Migrate command execution to structured argv lists across the plugin, replacing shell-string command construction with `vim.system` argv execution. The runner API now exposes argv-based execution as the default path:
- `runner.execute_command` -> `runner.execute`
- `runner.execute_command_async` -> `runner.execute_async`
- `runner.execute_command_raw` -> `runner.execute_raw`
- `runner.execute_command_raw_async` -> `runner.execute_raw_async`
- `runner.execute_command_sync` was removed; use `runner.execute` and handle the result directly
BREAKING CHANGES:
- `cmd.new({ args = ... })` now requires `args` as `string[]` argv tokens, not a single string.
- `cmd.log({ ... })` now uses `raw_flags` as `string[]` for raw passthrough flags; `raw = "..."` is no longer supported.
- Direct users of `jj.core.runner` must migrate from the old `execute_command*` string helpers to the new argv-based `execute*` helpers.
This commit is contained in:
+10
-7
@@ -19,21 +19,24 @@ local default_describe_opts = {
|
||||
--- @param revset? string The revision to describe
|
||||
--- @param sync? boolean Whether to execute command synchronously
|
||||
local function execute_describe(description, revset, sync)
|
||||
local cmd = "jj describe"
|
||||
local cmd = {
|
||||
"jj",
|
||||
"describe",
|
||||
}
|
||||
if revset then
|
||||
cmd = cmd .. " -r " .. revset
|
||||
table.insert(cmd, "-r")
|
||||
table.insert(cmd, revset)
|
||||
end
|
||||
cmd = cmd .. " --stdin"
|
||||
table.insert(cmd, "--stdin")
|
||||
|
||||
-- Use --stdin to properly handle multi-line and special characters
|
||||
if sync then
|
||||
runner.execute_command_sync(cmd, function()
|
||||
utils.notify("Description set.", vim.log.levels.INFO)
|
||||
end, "Failed to describe", description)
|
||||
runner.execute(cmd, "Failed to describe", description)
|
||||
utils.notify("Description set.", vim.log.levels.INFO)
|
||||
return
|
||||
end
|
||||
|
||||
runner.execute_command_async(cmd, function()
|
||||
runner.execute_async(cmd, function()
|
||||
utils.notify("Description set.", vim.log.levels.INFO)
|
||||
end, "Failed to describe", description)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user