local M = {}

function M.cc(tbl, sep)
	return table.concat(tbl, sep or "")
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

function M.run(cmd)
	cmd = cmd or "echo nil"
	local p = io.popen(cmd)
	if not p then
		return nil
	end
	local r = p:read("*a"):gsub("%s+$", "")
	p:close()
	return r
end

return M
