Allow specifying multiple matching hostnames
This commit is contained in:
parent
3f3efab221
commit
499b30d175
@ -19,7 +19,8 @@ defconf = os.path.join(config_dir, 'ssh.conf')
|
||||
def options_for_host(hostname: str, per_host_opts: Dict[str, SSHOptions]) -> SSHOptions:
|
||||
import fnmatch
|
||||
matches = []
|
||||
for pat, opts in per_host_opts.items():
|
||||
for spat, opts in per_host_opts.items():
|
||||
for pat in spat.split():
|
||||
if fnmatch.fnmatchcase(hostname, pat):
|
||||
matches.append(opts)
|
||||
if not matches:
|
||||
|
||||
@ -26,12 +26,12 @@ agr('host', 'Host environment') # {{{
|
||||
opt('hostname', '*', option_type='hostname',
|
||||
long_text='''
|
||||
The hostname the following options apply to. A glob pattern to match multiple
|
||||
hosts can be used. When not specified options apply to all hosts, until the
|
||||
hosts can be used. Multiple hostnames can also be specified separated by spaces.
|
||||
When not specified options apply to all hosts, until the
|
||||
first hostname specification is found. Note that the hostname this matches
|
||||
against is the hostname used by the remote computer, not the name you pass
|
||||
to SSH to connect to it. If you wish to include the same configuration for many
|
||||
different hosts, you can do so with the :code:`include` directive (see :doc:`conf`),
|
||||
so that you need only two lines per host.
|
||||
to SSH to connect to it. If you wish to include the same basic configuration for many
|
||||
different hosts, you can do so with the :code:`include` directive (see :doc:`conf`).
|
||||
''')
|
||||
|
||||
opt('+copy', '', option_type='copy', add_to_default=False, long_text=f'''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user