Browse Source

Using / as a separator instead of .

neo
Raphael Roberts 6 years ago
parent
commit
2e59d64e6d
  1. 6
      ssh_config_utils/config_file.py

6
ssh_config_utils/config_file.py

@ -5,6 +5,8 @@ from ssh_config_utils.parser import parse_config_text
class HostGroup: class HostGroup:
SEPARATOR = "/"
def __init__(self, name): def __init__(self, name):
self.parent = None self.parent = None
self.name = name self.name = name
@ -24,7 +26,7 @@ class HostGroup:
def fullpath(self): def fullpath(self):
if self.parent is None: if self.parent is None:
return "" return ""
return ".".join(self.parent.fullpath(), self.name)
return HostGroup.SEPARATOR.join(self.parent.fullpath(), self.name)
def hosts(self): def hosts(self):
for child in self.children.values(): for child in self.children.values():
@ -106,7 +108,7 @@ class GroupedConfigFile(ConfigFile):
host: Host host: Host
for host in hosts: for host in hosts:
current = self.root_group current = self.root_group
parts = host.name.split(".")
parts = host.name.split(HostGroup.SEPARATOR)
host.name = parts[-1] host.name = parts[-1]
for path in parts[:-1]: for path in parts[:-1]:
current = current.add_child_group(path) current = current.add_child_group(path)

Loading…
Cancel
Save