TangentFox icon

pkg-search [extension for cc-pkg]

TangentFox | PRO | 12/12/23 01:32:24 AM UTC (Edited) | 0 ⭐ | 632 👁️ | Never ⏰ | []
Lua |

520 B

|

None

|

0 👍

/

0 👎

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