Skip to content

Commit 8b25726

Browse files
committed
feat(lua): add jj_interactive
1 parent 354fa92 commit 8b25726

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

internal/scripting/lua.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,14 @@ func registerAPI(L *lua.LState, runner *Runner) {
226226
return 1
227227
}))
228228

229-
runAsyncFn := L.NewFunction(func(L *lua.LState) int {
229+
jjAsyncFn := L.NewFunction(func(L *lua.LState) int {
230230
args := argsFromLua(L)
231231
return yieldStep(L, step{cmd: runner.ctx.RunCommand(args)})
232232
})
233+
jjInteractiveFn := L.NewFunction(func(L *lua.LState) int {
234+
args := argsFromLua(L)
235+
return yieldStep(L, step{cmd: runner.ctx.RunInteractiveCommand(args, nil)})
236+
})
233237
jjFn := L.NewFunction(func(L *lua.LState) int {
234238
args := argsFromLua(L)
235239
out, err := runner.ctx.RunCommandImmediate(args)
@@ -262,7 +266,8 @@ func registerAPI(L *lua.LState, runner *Runner) {
262266
root := L.NewTable()
263267
root.RawSetString("revisions", revisionsTable)
264268
root.RawSetString("revset", revsetTable)
265-
root.RawSetString("jj_async", runAsyncFn)
269+
root.RawSetString("jj_async", jjAsyncFn)
270+
root.RawSetString("jj_interactive", jjInteractiveFn)
266271
root.RawSetString("jj", jjFn)
267272
root.RawSetString("flash", flashFn)
268273
root.RawSetString("copy_to_clipboard", copyToClipboardFn)
@@ -271,7 +276,8 @@ func registerAPI(L *lua.LState, runner *Runner) {
271276
// but also expose at the top level for convenience
272277
L.SetGlobal("revisions", revisionsTable)
273278
L.SetGlobal("revset", revsetTable)
274-
L.SetGlobal("jj_async", runAsyncFn)
279+
L.SetGlobal("jj_async", jjAsyncFn)
280+
L.SetGlobal("jj_interactive", jjInteractiveFn)
275281
L.SetGlobal("jj", jjFn)
276282
L.SetGlobal("flash", flashFn)
277283
L.SetGlobal("copy_to_clipboard", copyToClipboardFn)

0 commit comments

Comments
 (0)