Skip to content

Commit

Permalink
Ta høyde for newlines i gcp-service-accounts (#109)
Browse files Browse the repository at this point in the history
Vi er nødt til å ta høyde for at det ikke eksisterer noen newline der vi
legger inn variabler, samtidig som at vi ikke ønsker å lage unødvendig
mange newlines.
  • Loading branch information
augustdahl authored Oct 1, 2024
1 parent f77b7af commit 28370fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def append_content_to_end_of_file(file_path: str, content: str) -> None:
with open(file_path) as file:
lines = file.readlines()
file.close()

if lines and not lines[-1].endswith('\n'):
lines[-1] += '\n'

lines.insert(len(lines), '\n' + content)

with open(file_path, 'w') as file:
Expand Down

0 comments on commit 28370fc

Please sign in to comment.