diff options
Diffstat (limited to 'lib/python/qmk/commands.py')
| -rw-r--r-- | lib/python/qmk/commands.py | 5 |
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(): | |||
| 98 | return active_prefix != sys.prefix | 98 | return active_prefix != sys.prefix |
| 99 | 99 | ||
| 100 | 100 | ||
| 101 | def dump_lines(output_file, lines, quiet=True): | 101 | def dump_lines(output_file, lines, quiet=True, remove_repeated_newlines=False): |
| 102 | """Handle dumping to stdout or file | 102 | """Handle dumping to stdout or file |
| 103 | Creates parent folders if required | 103 | Creates parent folders if required |
| 104 | """ | 104 | """ |
| 105 | generated = '\n'.join(lines) + '\n' | 105 | generated = '\n'.join(lines) + '\n' |
| 106 | if remove_repeated_newlines: | ||
| 107 | while '\n\n\n' in generated: | ||
| 108 | generated = generated.replace('\n\n\n', '\n\n') | ||
| 106 | if output_file and output_file.name != '-': | 109 | if output_file and output_file.name != '-': |
| 107 | output_file.parent.mkdir(parents=True, exist_ok=True) | 110 | output_file.parent.mkdir(parents=True, exist_ok=True) |
| 108 | if output_file.exists(): | 111 | if output_file.exists(): |
