`qmk format-json`: Force Unix line endings and ensure LF at EOF (#22901)

master
Ryan 2024-01-16 17:13:58 +11:00 committed by GitHub
parent a522b1f156
commit 2b0965944d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -92,8 +92,8 @@ def format_json(cli):
output = json.dumps(json_data, cls=json_encoder, sort_keys=True) output = json.dumps(json_data, cls=json_encoder, sort_keys=True)
if cli.args.inplace: if cli.args.inplace:
with open(cli.args.json_file, 'w+', encoding='utf-8') as outfile: with open(cli.args.json_file, 'w+', encoding='utf-8', newline='\n') as outfile:
outfile.write(output) outfile.write(output + '\n')
# Display the results if print was set # Display the results if print was set
# We don't operate in-place by default, so also display to stdout # We don't operate in-place by default, so also display to stdout