generated from eblume/project-template
26 lines
671 B
Lua
26 lines
671 B
Lua
|
|
--- Small shared helpers: URIs, dates, notifications.
|
||
|
|
|
||
|
|
local M = {}
|
||
|
|
|
||
|
|
--- Today's date as an ISO `YYYY-MM-DD`. Uses the real wall clock — the plugin
|
||
|
|
--- picks "today"; `heph-core` stays clock-injected, this is surface-only.
|
||
|
|
function M.iso_today()
|
||
|
|
return os.date("%Y-%m-%d")
|
||
|
|
end
|
||
|
|
|
||
|
|
--- The buffer URI for a node id.
|
||
|
|
function M.node_uri(id)
|
||
|
|
return "heph://node/" .. id
|
||
|
|
end
|
||
|
|
|
||
|
|
--- Parse a `heph://<kind>/<id>` URI into `kind, id` (nil on no match).
|
||
|
|
function M.parse_uri(uri)
|
||
|
|
return uri:match("^heph://([^/]+)/(.+)$")
|
||
|
|
end
|
||
|
|
|
||
|
|
--- Notify with a consistent `heph:` prefix.
|
||
|
|
function M.notify(msg, level)
|
||
|
|
vim.notify("heph: " .. msg, level or vim.log.levels.INFO)
|
||
|
|
end
|
||
|
|
|
||
|
|
return M
|