Skip to content

Commit 619520c

Browse files
committed
Added multi-line msg support to print_trunc() ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/remove-json-keys]
1 parent 5e008db commit 619520c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

chromium/utils/remove-json-keys.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
Script: remove-json-keys.py
3-
Version: 2025.2.7
3+
Version: 2025.2.7.1
44
Description: Remove key/value pairs from json_folder/**.json
55
Author: Adam Lui
66
URL: https://github.com/adamlui/python-utils
@@ -13,7 +13,10 @@
1313
# UI initializations
1414
os.system('color') ; print('\033[0;92m') # set font to bright green
1515
terminal_width = os.get_terminal_size()[0]
16-
def print_trunc(msg, end='\n') : print(msg if len(msg) < terminal_width else msg[0:terminal_width-4] + '...', end=end)
16+
def print_trunc(msg, end='\n'):
17+
truncated_lines = [
18+
line if len(line) < terminal_width else line[:terminal_width - 4] + '...' for line in msg.splitlines() ]
19+
print('\n'.join(truncated_lines), end=end)
1720

1821
print('')
1922

0 commit comments

Comments
 (0)