summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-05 13:57:25 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-05 13:57:25 +0200
commit0e12fe5bfefa9695a685af4fe5ea5259696c20b4 (patch)
treed7f772fb0c15f2e43d002a48fa1521b378345233
parent00f16475db99f40c37dced20aa5ce37e568a4200 (diff)
Validate entry arguments
-rw-r--r--tests/package_shell_test.lua7
-rw-r--r--yazi-enter.yazi/main.lua4
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/package_shell_test.lua b/tests/package_shell_test.lua
index da3ab2b..9330c71 100644
--- a/tests/package_shell_test.lua
+++ b/tests/package_shell_test.lua
@@ -29,6 +29,9 @@ end
local sync_calls = 0
local sync_callbacks = {}
local environment = {
+ error = error,
+ pairs = pairs,
+ type = type,
ya = {
sync = function(callback)
sync_calls = sync_calls + 1
@@ -45,7 +48,9 @@ local plugin = chunk()
assert(sync_calls == 1, "expected one top-level synchronous transaction")
assert(type(plugin) == "table", "plugin must export a table")
assert(type(plugin.entry) == "function", "plugin must export an entry method")
-assert(plugin.entry() == nil, "entry shell must load with the bundled runtime")
+
+local intent = plugin:entry({ args = { "directory" } })
+assert(intent.mode == "directory", "entry shell must load with the bundled runtime")
assert(sync_callbacks[1]() == 0, "commit shell must load with the bundled runtime")
print("package shell checks passed")
diff --git a/yazi-enter.yazi/main.lua b/yazi-enter.yazi/main.lua
index 2edee41..33c0abe 100644
--- a/yazi-enter.yazi/main.lua
+++ b/yazi-enter.yazi/main.lua
@@ -87,5 +87,7 @@ local commit = ya.sync(function()
end)
return {
- entry = function() end,
+ entry = function(_, job)
+ return parse_invocation_intent(job.args)
+ end,
}