Initial commit

This commit is contained in:
2024-10-02 14:54:32 +02:00
commit 14af275c5c
27 changed files with 1871 additions and 0 deletions

30
lua/cave/context.lua Normal file
View File

@@ -0,0 +1,30 @@
local Meta = require "cave.meta"
local Path = require "cave.path"
local Str = Meta.String
local validate = Meta.validate
---@class cave.Context
---@field dir cave.Path
---@field name string
---@field uuid string
local Context = Meta.derive "Context"
---@param dir cave.Path
---@param name string
---@param uuid string
function Context:init(dir, name, uuid)
validate { dir = { dir, Path }, uuid = { uuid, Str }, name = { name, Str } }
self.dir = dir
self.name = name
self.uuid = uuid
end
---@return string
function Context:tostring()
return ("Context(dir=%q, name=%q, uuid=%q)"):format(self.dir, self.name, self.uuid)
end
Context.__tostring = Context.tostring
return Context