summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-05 13:54:55 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-05 13:54:55 +0200
commit46623bd0df2d3dedd5d6d97f33c299b9271636eb (patch)
treed2823b60d43bdd5db076accc5832b64453ca5f61
parentf32f6c8295a55e111f873e99a76ecb55afbc4c20 (diff)
Normalize Boolean options
-rw-r--r--yazi-enter.yazi/main.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/yazi-enter.yazi/main.lua b/yazi-enter.yazi/main.lua
index 6765576..10ed117 100644
--- a/yazi-enter.yazi/main.lua
+++ b/yazi-enter.yazi/main.lua
@@ -8,6 +8,17 @@ local function parse_mode(value)
error("yazi-enter: mode must be directory, file, or either", 0)
end
+local function normalize_boolean(name, value)
+ if value == nil or value == false or value == "no" then
+ return false
+ end
+ if value == true or value == "yes" then
+ return true
+ end
+
+ error(("yazi-enter: option --%s must be true, false, 'yes', or 'no'"):format(name), 0)
+end
+
local commit = ya.sync(function()
return 0
end)