Strip leading whitespace sooner
This commit is contained in:
parent
35406e7675
commit
dfc18afaf6
4
run.py
4
run.py
@ -85,7 +85,7 @@ def convert_template(env, template, key_value_store, out):
|
|||||||
default_permissions = 0o666 & ~get_current_umask()
|
default_permissions = 0o666 & ~get_current_umask()
|
||||||
|
|
||||||
template = env.from_string(source)
|
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)
|
out_dir_name = os.path.dirname(out)
|
||||||
if not os.path.isdir(out_dir_name):
|
if not os.path.isdir(out_dir_name):
|
||||||
@ -156,7 +156,7 @@ def get_current_umask():
|
|||||||
def dryrun_safe_write(location, content):
|
def dryrun_safe_write(location, content):
|
||||||
if not args.dryrun:
|
if not args.dryrun:
|
||||||
with open(location, 'w') as file:
|
with open(location, 'w') as file:
|
||||||
file.write(content.lstrip())
|
file.write(content)
|
||||||
else:
|
else:
|
||||||
print(f'Would write to `{location}`.')
|
print(f'Would write to `{location}`.')
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user