Search for names in modules


#1

Is there a way to search for all names in installed packages containing a given string? Something like

searchpkg(str) =
  for pkg in keys(Pkg.installed())
    filter(x -> contains(x, str), string.(names(pkg)))
  end

That doesn’t work though because pkg is a string and names wants a module. Also it is probably not very efficient.


#2

If you want names search, you have to load the module. You can do that with eval and you’ll get the Module you want. If you want to do string search, then just iterate through the files.