fix: Don't push past midnight. You'll make clason's stuff break :/

This commit is contained in:
TJ DeVries
2020-09-04 09:49:10 -04:00
parent 996f69465e
commit 14310ee6b1
9 changed files with 352 additions and 223 deletions

View File

@@ -31,7 +31,7 @@ utils.reversed_ipairs = function(t)
return reversedipairsiter, t, #t + 1
end
utils.default_table_mt = {
utils.default_table_mt = {
__index = function(t, k)
local obj = {}
rawset(t, k, obj)
@@ -114,4 +114,28 @@ utils.path_shorten = (function()
end
end)()
-- local x = utils.make_default_callable(function(opts)
-- return function()
-- print(opts.example, opts.another)
-- end
-- end, { example = 7, another = 5 })
-- x()
-- x.new { example = 3 }()
function utils.make_default_callable(f, default_opts)
return setmetatable({
new = function(opts)
opts = vim.tbl_extend("keep", opts, default_opts)
return f(opts)
end,
}, {
__call = function()
local ok, err = pcall(f(default_opts))
if not ok then
error(debug.traceback(err))
end
end
})
end
return utils