Skip to content

add mechanism to filter out known hostnames #720

Open
@calestyo

Description

@calestyo

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 and host.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions