Advertisement
TangentFox

pkg-search [extension for cc-pkg]

Jan 21st, 2020 (edited)
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local args = {...}
  2. local match = args[1]
  3.  
  4. if match then
  5.   match = match:gsub("%-", "%%-")
  6.   local sources = {}
  7.   if fs.exists("/etc/pkg/names.list") then
  8.     for line in io.lines("/etc/pkg/names.list") do
  9.       local s = line:find("=")
  10.       local name = line:sub(1, s - 1)
  11.       if name:find(match) then
  12.         table.insert(sources, name)
  13.       end
  14.     end
  15.   end
  16.   print("Matching packages: " .. table.concat(sources, ", "))
  17. else
  18.   print("You must specify a name or part of a name to search for packages.")
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement