Strip leading whitespace sooner

This commit is contained in:
Daniel_I_Am 2022-01-06 20:26:34 +01:00
parent 35406e7675
commit dfc18afaf6

4
run.py
View File

@ -85,7 +85,7 @@ def convert_template(env, template, key_value_store, out):
default_permissions = 0o666 & ~get_current_umask()
template = env.from_string(source)
rendered = template.render(**key_value_store)
rendered = template.render(**key_value_store).lstrip()
out_dir_name = os.path.dirname(out)
if not os.path.isdir(out_dir_name):
@ -156,7 +156,7 @@ def get_current_umask():
def dryrun_safe_write(location, content):
if not args.dryrun:
with open(location, 'w') as file:
file.write(content.lstrip())
file.write(content)
else:
print(f'Would write to `{location}`.')