Skip to content

Commit

Permalink
v0.2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
yh202109 committed Jul 13, 2024
1 parent a952fcd commit 40fcc20
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mtbp3/health/ectd.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ def find_section_given_words(self, words, outfmt='simple', include='up', to_righ
raise ValueError("Invalid value for include. Supported values are 'up' and 'both'.")

out = [row for row in self.ctoc if any(word.lower() in row.lower() for word in words)]
out_colored = []
for row in out:
for word in words:
start = row.lower().index(word.lower())
end = start + len(word)
row = row[:start] + f"\033[91m{row[start:end]}\033[0m" + row[end:]
out_colored.append(row)
out = out_colored
if outfmt == 'simple':
return out
elif outfmt == 'tree':
Expand Down

0 comments on commit 40fcc20

Please sign in to comment.