File tree Expand file tree Collapse file tree 1 file changed +51
-4
lines changed Expand file tree Collapse file tree 1 file changed +51
-4
lines changed Original file line number Diff line number Diff line change 2121from rich .text import Text
2222from rich .syntax import Syntax
2323from rich .panel import Panel
24+ from rich .terminal_theme import TerminalTheme
2425from rich .terminal_theme import MONOKAI
2526from subprocess import call
2627
2728from packaging import version
2829
2930
30- console = Console (record = True )
31-
3231RECOMMENDATIONS = 0
3332HIGH = 1
3433WARN = 2
133132 help = 'Export the report as an SVG image'
134133)
135134
135+ parser .add_argument (
136+ '--light' ,
137+ default = False ,
138+ action = 'store_true' ,
139+ dest = 'export_theme_light' ,
140+ help = 'Use a light theme for the report when generating files'
141+ )
142+
143+ parser .add_argument (
144+ '--size' ,
145+ default = False ,
146+ dest = 'export_size' ,
147+ help = 'Console width used for the report and generated files'
148+ )
149+
136150parser .add_argument (
137151 '--verbose' ,
138152 default = False ,
167181
168182args = parser .parse_args ()
169183
184+ if args .export_size :
185+ console = Console (record = True , width = int (args .export_size ))
186+ else :
187+ console = Console (record = True )
170188
171189csv_report = []
172190
191+
173192def validate_thresholds ():
174193 """
175194 Validate thresholds defined by the user.
@@ -1519,18 +1538,46 @@ def main():
15191538 )
15201539 )
15211540
1541+ if args .export_theme_light :
1542+ export_theme = TerminalTheme (
1543+ (255 , 255 , 255 ),
1544+ (0 , 0 , 0 ),
1545+ [
1546+ (26 , 26 , 26 ),
1547+ (244 , 0 , 95 ),
1548+ (152 , 224 , 36 ),
1549+ (253 , 151 , 31 ),
1550+ (157 , 101 , 255 ),
1551+ (244 , 0 , 95 ),
1552+ (88 , 209 , 235 ),
1553+ (120 , 120 , 120 ),
1554+ (98 , 94 , 76 ),
1555+ ],
1556+ [
1557+ (244 , 0 , 95 ),
1558+ (152 , 224 , 36 ),
1559+ (224 , 213 , 97 ),
1560+ (157 , 101 , 255 ),
1561+ (244 , 0 , 95 ),
1562+ (88 , 209 , 235 ),
1563+ (246 , 246 , 239 ),
1564+ ],
1565+ )
1566+ else :
1567+ export_theme = MONOKAI
1568+
15221569 if args .export_html :
15231570 console .save_html (
15241571 '{}.html' .format (args .darshan ),
1525- theme = MONOKAI ,
1572+ theme = export_theme ,
15261573 clear = False
15271574 )
15281575
15291576 if args .export_svg :
15301577 console .save_svg (
15311578 '{}.svg' .format (args .darshan ),
15321579 title = 'Drishti' ,
1533- theme = MONOKAI ,
1580+ theme = export_theme ,
15341581 clear = False
15351582 )
15361583
You can’t perform that action at this time.
0 commit comments