Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 51 additions & 4 deletions drishti/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
from rich.text import Text
from rich.syntax import Syntax
from rich.panel import Panel
from rich.terminal_theme import TerminalTheme
from rich.terminal_theme import MONOKAI
from subprocess import call

from packaging import version


console = Console(record=True)

RECOMMENDATIONS = 0
HIGH = 1
WARN = 2
Expand Down Expand Up @@ -133,6 +132,21 @@
help='Export the report as an SVG image'
)

parser.add_argument(
'--light',
default=False,
action='store_true',
dest='export_theme_light',
help='Use a light theme for the report when generating files'
)

parser.add_argument(
'--size',
default=False,
dest='export_size',
help='Console width used for the report and generated files'
)

parser.add_argument(
'--verbose',
default=False,
Expand Down Expand Up @@ -167,9 +181,14 @@

args = parser.parse_args()

if args.export_size:
console = Console(record=True, width=int(args.export_size))
else:
console = Console(record=True)

csv_report = []


def validate_thresholds():
"""
Validate thresholds defined by the user.
Expand Down Expand Up @@ -1519,18 +1538,46 @@ def main():
)
)

if args.export_theme_light:
export_theme = TerminalTheme(
(255, 255, 255),
(0, 0, 0),
[
(26, 26, 26),
(244, 0, 95),
(152, 224, 36),
(253, 151, 31),
(157, 101, 255),
(244, 0, 95),
(88, 209, 235),
(120, 120, 120),
(98, 94, 76),
],
[
(244, 0, 95),
(152, 224, 36),
(224, 213, 97),
(157, 101, 255),
(244, 0, 95),
(88, 209, 235),
(246, 246, 239),
],
)
else:
export_theme = MONOKAI

if args.export_html:
console.save_html(
'{}.html'.format(args.darshan),
theme=MONOKAI,
theme=export_theme,
clear=False
)

if args.export_svg:
console.save_svg(
'{}.svg'.format(args.darshan),
title='Drishti',
theme=MONOKAI,
theme=export_theme,
clear=False
)

Expand Down