pkg-search [extension for cc-pkg]
local args = {...}
local match = args[1]
if match then
match = match:gsub("%-", "%%-")
local sources = {}
if fs.exists("/etc/pkg/names.list") then
for line in io.lines("/etc/pkg/names.list") do
local s = line:find("=")
local name = line:sub(1, s - 1)
if name:find(match) then
table.insert(sources, name)
end
end
end
print("Matching packages: " .. table.concat(sources, ", "))
else
print("You must specify a name or part of a name to search for packages.")
end
Comments