Skip to content
Snippets Groups Projects
Commit fd98f050 authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Sort output and append final newline

parent 766f796e
No related branches found
No related tags found
No related merge requests found
Pipeline #3885 passed
...@@ -32,11 +32,16 @@ def main(): ...@@ -32,11 +32,16 @@ def main():
output = dict() output = dict()
for d in config["domains"]: for d in config["domains"]:
output[d] = {a for a in addresses if a.domain is None or a.domain == d} # set to make unique, list to make sortable
output[d] = list(
{a.localpart for a in addresses if a.domain is None or a.domain == d}
)
output[d].sort()
for k, v in output.items(): for k, v in output.items():
with open(config["output"].format(domain=k), "w") as f: with open(config["output"].format(domain=k), "w") as f:
f.write("\n".join(map(lambda a: a.localpart, v))) f.write("\n".join(v))
f.write("\n")
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment