Description
Hey.
It would be nice to have a simple way to filter out known hostnames that bash-completion gathers from files like /etc/hosts
or SSH’s various config files.
My use case is that I have some rather complex SSH config with special settings for many single hosts. Typically I don't use/need these hostsnames so I wouldn't want them to show up in completions as they break fast completions of those that I really use all the time, e.g. consider:
*.rarelyused.example.org
*.oftenused.example.org
maybe with pairs belonging together, one being the actual host, the other it's service processor, e.g.host.srv.example.org
andhost.sp.example.org
.
The idea would be something like a regular expression that is stored in some file (which is considered by bash-completion) and that can be used to remove any unwanted names, e.g.
^.+\.rarelyused\.example\.org$
would clear all the unwanted one.
A simple script could then add/remove that regexp and act as a switch,... so when I want to use these host names, I switch them on, otherwise off.
Such file could go into .config/bash-completion/
which may perhaps even be used for further purposes, e.g. a subdir .config/hosts.d/*.conf
which contains files with further hostnames (one per line per file),... which shall be completed but do not occur elsewhere.
Cheers,
Chris.