We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
print_trunc()
1 parent 5e008db commit 619520cCopy full SHA for 619520c
chromium/utils/remove-json-keys.py
@@ -1,6 +1,6 @@
1
'''
2
Script: remove-json-keys.py
3
-Version: 2025.2.7
+Version: 2025.2.7.1
4
Description: Remove key/value pairs from json_folder/**.json
5
Author: Adam Lui
6
URL: https://github.com/adamlui/python-utils
@@ -13,7 +13,10 @@
13
# UI initializations
14
os.system('color') ; print('\033[0;92m') # set font to bright green
15
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)
+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)
20
21
print('')
22
0 commit comments