<commit_before>--
-- option.lua
-- Work with the list of registered options.
-- Copyright (c) 2002-2014 <NAME> and the Premake project
--

	premake.option = {}
	local m = premake.option


--
-- We can't control how people will type in the command line arguments, or how
-- project scripts will define their custom options, so case becomes an issue.
-- To mimimize issues, set up the _OPTIONS table to always use lowercase keys.
--

	local _OPTIONS_metatable = {
		__index = function(tbl, key)
			if type(key) == "string" then
				key = key:lower()
			end
			return rawget(tbl, key)
		end,
		__newindex = function(tbl, key, value)
			if type(key) == "string" then
				key = key:lower()
			end
			rawset(tbl, key, value)
		end
	}

	_OPTIONS = {}
	setmetatable(_OPTIONS, _OPTIONS_metatable)


--
-- Process the raw command line arguments from _ARGV to populate
-- the _OPTIONS table
--

	for i, arg in ipairs(_ARGV) do
		local key, value
		local i = arg:find("=", 1, true)
		if i then
			key = arg:sub(1, i - 1)
			value = arg:sub(i + 1)
		else
			key = arg
			value = ""
		end

		if key:startswith("/") then
			_OPTIONS[key:sub(2)] = value
		elseif key:startswith("--") then
			_OPTIONS[key:sub(3)] = value
		end
	end



--
-- The list of registered options. Calls to newoption() will add
-- new entries here.
--

	m.list = {}


--
-- Register a new option.
--
-- @param opt
--    The new option object.
--

	function m.add(opt)
		-- some sanity checking
		local missing
		for _, field in ipairs({ "description", "trigger" }) do
			if (not opt[field]) then
				missing = field
			end
		end

		if (missing) then
			error("option needs a " .. missing, 3)
		end

		-- add it to the master list
		premake.option.list[opt.trigger] = opt

		-- if it has a default value, set it.
		if opt.default and not _OPTIONS[opt.trigger] then
			_OPTIONS[opt.trigger] = opt.default
		end
	end



--
-- Retrieve an option by name.
--
-- @param name
--    The name of the option to retrieve.<commit_msg>Fixed options not being added to the list as lowercase. Fixes: 216<commit_after>--
-- option.lua
-- Work with the list of registered options.
-- Copyright (c) 2002-2014 <NAME> and the Premake project
--

	premake.option = {}
	local m = premake.option


--
-- We can't control how people will type in the command line arguments, or how
-- project scripts will define their custom options, so case becomes an issue.
-- To mimimize issues, set up the _OPTIONS table to always use lowercase keys.
--

	local _OPTIONS_metatable = {
		__index = function(tbl, key)
			if type(key) == "string" then
				key = key:lower()
			end
			return rawget(tbl, key)
		end,
		__newindex = function(tbl, key, value)
			if type(key) == "string" then
				key = key:lower()
			end
			rawset(tbl, key, value)
		end
	}

	_OPTIONS = {}
	setmetatable(_OPTIONS, _OPTIONS_metatable)


--
-- Process the raw command line arguments from _ARGV to populate
-- the _OPTIONS table
--

	for i, arg in ipairs(_ARGV) do
		local key, value
		local i = arg:find("=", 1, true)
		if i then
			key = arg:sub(1, i - 1)
			value = arg:sub(i + 1)
		else
			key = arg
			value = ""
		end

		if key:startswith("/") then
			_OPTIONS[key:sub(2)] = value
		elseif key:startswith("--") then
			_OPTIONS[key:sub(3)] = value
		end
	end



--
-- The list of registered options. Calls to newoption() will add
-- new entries here.
--

	m.list = {}


--
-- Register a new option.
--
-- @param opt
--    The new option object.
--

	function m.add(opt)
		-- some sanity checking
		local missing
		for _, field in ipairs({ "description", "trigger" }) do
			if (not opt[field]) then
				missing = field
			end
		end

		if (missing) then
			error("option needs a " .. missing, 3)
		end

		-- add it to the master list
		premake.option.list[opt.trigger:lower()] = opt

		-- if it has a default value, set it.
		if opt.default and not _OPTIONS[opt.trigger] then
			_OPTIONS[opt.trigger] = opt.default
		end
	end



--
-- Retrieve an option by name.
--
-- @param name
--    The name of the option to retrieve.
{'fraction_non_alphanumeric': 0.12204822271936366, 'fraction_numerical': 0.00820283370618941, 'mean_word_length': 2.6548592188919162, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1636132', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1351, 'n_words': 496}