Parser: remove empty last line
This commit is contained in:
parent
c291a3f5cb
commit
783ea0efa0
1 changed files with 4 additions and 2 deletions
|
@ -126,7 +126,7 @@ def parse_yaml(data):
|
|||
def to_ssh_config_string(parse):
|
||||
s = str()
|
||||
|
||||
for host, keys in parse.items():
|
||||
for i, (host, keys) in enumerate(parse.items()):
|
||||
lines = list()
|
||||
|
||||
for key, values in keys.items():
|
||||
|
@ -137,7 +137,9 @@ def to_ssh_config_string(parse):
|
|||
lines.append(f"\t{key} {value}")
|
||||
|
||||
# join the sorted lines on a new line character
|
||||
s += f"Host {host}\n" + "\n".join(sorted(lines)) + "\n\n"
|
||||
s += f"Host {host}\n" + "\n".join(sorted(lines))
|
||||
|
||||
s += "\n\n" if i < len(parse) - 1 else "\n"
|
||||
|
||||
return s
|
||||
|
||||
|
|
Loading…
Reference in a new issue