aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/commands.py
diff options
context:
space:
mode:
authorNick Brassel <[email protected]>2025-02-26 22:25:41 +1100
committerGitHub <[email protected]>2025-02-26 22:25:41 +1100
commit1efc82403bebe759272d1ba7a79d9dfa0d5df506 (patch)
treec356ae7afeb0849926534beb5dd4515f693abf99 /lib/python/qmk/commands.py
parent63b095212b157c4522bdeda3de144fb87213085d (diff)
downloadqmk_firmware-1efc82403bebe759272d1ba7a79d9dfa0d5df506.tar.gz
qmk_firmware-1efc82403bebe759272d1ba7a79d9dfa0d5df506.zip
Community modules (#24848)
Diffstat (limited to 'lib/python/qmk/commands.py')
-rw-r--r--lib/python/qmk/commands.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index a05b3641b5..0e1876ca7a 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -98,11 +98,14 @@ def in_virtualenv():
return active_prefix != sys.prefix
-def dump_lines(output_file, lines, quiet=True):
+def dump_lines(output_file, lines, quiet=True, remove_repeated_newlines=False):
"""Handle dumping to stdout or file
Creates parent folders if required
"""
generated = '\n'.join(lines) + '\n'
+ if remove_repeated_newlines:
+ while '\n\n\n' in generated:
+ generated = generated.replace('\n\n\n', '\n\n')
if output_file and output_file.name != '-':
output_file.parent.mkdir(parents=True, exist_ok=True)
if output_file.exists():