Auto-completion
I'd briefly looked into this once in the past, but having Portmod support command line auto-completion would be really useful.
Argcomplete seems to make sense, however there are caveats such as initialization time slowing down completions (it currently takes 0.8s on my machine to print portmod's help message, which is rather laggy for completions).
It probably wouldn't be a bad idea though to try and optimize our global code anyway. To be honest, I'm not entirely sure why the global code is so slow (perhaps just because we have a lot of modules?), though I've run into slow-to-import external libraries in the past (redbaron and p7zip), which could be a contributing factor here (lots of modules, plus lots of external modules).
One way to handle it would be to get rid of portmod's root import names (the stuff imported in portmod/__init__.py
), and separate the initial entry point and argument parsing from the actual main code (which is imported from within the function after argument parsing has been completed). That way nothing needs to be loaded other than argparse prior to the argcomplete call.
Package names could be cached when syncing repos to reduce the i/o requirements for atom completions.
Probably could be implemented alongside #118 (closed) and #155 (closed).