large changes
This commit is contained in:
29
lib/util.lua
29
lib/util.lua
@@ -3,12 +3,33 @@ local symbol = require("lib.symbol")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.cc(tbl)
|
||||
return table.concat(tbl)
|
||||
function M.cc(tbl, sep)
|
||||
return table.concat(tbl, sep or "")
|
||||
end
|
||||
|
||||
function M.copyright(link, holder)
|
||||
return symbol.copyright .. " " .. std.external(link, holder)
|
||||
function M.year(y)
|
||||
return y or os.date("%Y")
|
||||
end
|
||||
|
||||
function M.copyright(link, holder, year)
|
||||
return symbol.legal.copyright .. " " .. M.year(year) .. " " .. std.external(link, holder)
|
||||
end
|
||||
|
||||
function M.license(name)
|
||||
return symbol.legal.registered .. " " .. name
|
||||
end
|
||||
|
||||
function M.ls(dir)
|
||||
local p = io.popen('ls -A -1 -- ' .. string.format('%q', dir))
|
||||
if not p then
|
||||
return nil
|
||||
end
|
||||
local t = {}
|
||||
for line in p:lines() do
|
||||
t[#t + 1] = line
|
||||
end
|
||||
p:close()
|
||||
return t
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user