--- @since 26.9.1 local DIRECTION_FORWARD = "forward" local DIRECTION_BACKWARD = "backward" local ACCEPTED_OPTIONS = { previous = true, smart = true, insensitive = true, } local function parse_mode(value) if value == "directory" or value == "file" or value == "either" then return value end 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 function normalize_options(args) return normalize_boolean("previous", args.previous), normalize_boolean("smart", args.smart), normalize_boolean("insensitive", args.insensitive) end local function validate_argument_keys(args) for key in pairs(args) do local key_type = type(key) if key_type == "number" and key ~= 1 then error(("yazi-enter: unexpected positional argument at index %s"):format(key), 0) elseif key_type == "string" and not ACCEPTED_OPTIONS[key] then error(("yazi-enter: unknown option --%s"):format(key), 0) elseif key_type ~= "number" and key_type ~= "string" then error("yazi-enter: argument keys must be positional indexes or option names", 0) end end end local function derive_direction(previous) if previous then return DIRECTION_BACKWARD end return DIRECTION_FORWARD end local commit = ya.sync(function() return 0 end) return { entry = function() end, }