From 0843d83d09179d96b8d931269c9650829c06b7f1 Mon Sep 17 00:00:00 2001 From: funilrys Date: Sat, 13 Jul 2019 21:06:30 +0200 Subject: [PATCH] =?UTF-8?q?It's=20stupid=20that=20it=20should=20be=20at=20?= =?UTF-8?q?the=20very=20top=20but=20yeah=20I=20fixed=20it...=20=C2=AF\=5F(?= =?UTF-8?q?=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- updateHostsFile.py | 48 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/updateHostsFile.py b/updateHostsFile.py index e554fe891..645ccb90f 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -1015,6 +1015,31 @@ def write_opening_header(final_file, **header_params): file_contents = final_file.read() # Save content. final_file.seek(0) # Write at the top. + + if header_params["extensions"]: + if len(header_params["extensions"]) > 1: + write_data( + final_file, + "# Title: StevenBlack/hosts with the {0} and {1} extensions\n#\n".format( + ", ".join(header_params["extensions"][:-1]), + header_params["extensions"][-1], + ), + ) + else: + write_data( + final_file, + "# Title: StevenBlack/hosts with the {0} extension\n#\n".format( + ", ".join(header_params["extensions"]) + ), + ) + else: + write_data( + final_file, + "# Title: StevenBlack/hosts\n#\n".format( + ", ".join(header_params["extensions"]) + ), + ) + write_data( final_file, "# This hosts file is a merged collection " @@ -1034,29 +1059,6 @@ def write_opening_header(final_file, **header_params): + "\n", ) - if len(header_params["extensions"]) > 1: - write_data( - final_file, - "# Title: StevenBlack/hosts with the {0} and {1} extensions\n".format( - ", ".join(header_params["extensions"][:-1]), - header_params["extensions"][-1], - ), - ) - else: - write_data( - final_file, - "# Title: StevenBlack/hosts with the {0} extension\n".format( - ", ".join(header_params["extensions"]) - ), - ) - else: - write_data( - final_file, - "# Title: StevenBlack/hosts\n".format( - ", ".join(header_params["extensions"]) - ), - ) - write_data( final_file, (