diff --git a/ssh_config_utils/config_file.py b/ssh_config_utils/config_file.py index 2340e39..1c84687 100644 --- a/ssh_config_utils/config_file.py +++ b/ssh_config_utils/config_file.py @@ -4,6 +4,25 @@ from ssh_config_utils.host import GlobalHost, Host from ssh_config_utils.parser import parse_config_text +class HostGroup: + def __init__(self, name): + self.parent = None + self.name = name + self.children = [] + + def add_child_group(self, name): + child = HostGroup(name) + child.parent = self + self.children.append(self) + return child + + @property + def fullpath(self): + if self.parent is None: + return "" + return ".".join(self.parent.fullpath(), self.name) + + class ConfigFile: def __init__(self, global_host, hosts): self.hosts = {}