2022-05-01 01:22:37 +00:00
|
|
|
local opts = {}
|
|
|
|
hilbish.opts = {}
|
|
|
|
|
|
|
|
setmetatable(hilbish.opts, {
|
|
|
|
__newindex = function(_, k, v)
|
|
|
|
if opts[k] == nil then
|
|
|
|
error(string.format('opt %s does not exist', k))
|
|
|
|
end
|
|
|
|
|
|
|
|
opts[k] = v
|
|
|
|
end,
|
|
|
|
__index = function(_, k)
|
|
|
|
return opts[k]
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
local function setupOpt(name, default)
|
|
|
|
opts[name] = default
|
|
|
|
require('nature.opts.' .. name)
|
|
|
|
end
|
|
|
|
|
|
|
|
local defaultOpts = {
|
2022-07-09 20:49:56 +00:00
|
|
|
autocd = false,
|
2022-07-11 00:17:28 +00:00
|
|
|
history = true,
|
2022-07-09 21:15:13 +00:00
|
|
|
greeting = string.format([[Welcome to {magenta}Hilbish{reset}, {cyan}%s{reset}.
|
|
|
|
The nice lil shell for {blue}Lua{reset} fanatics!
|
2022-07-09 21:54:21 +00:00
|
|
|
]], hilbish.user),
|
|
|
|
motd = true
|
2022-05-01 01:22:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for optsName, default in pairs(defaultOpts) do
|
|
|
|
setupOpt(optsName, default)
|
|
|
|
end
|