Skip to content

Commit

Permalink
add colors to other commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouramie committed Dec 15, 2024
1 parent 72a2685 commit 4738ce7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions worlds/stardew_valley/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _cmd_explain(self, location: str = ""):
return

self.ctx.previous_explanation = expl
logger.info(str(expl).strip())
self.ctx.ui.print_json(parse_explanation(expl))

@mark_raw
def _cmd_explain_item(self, item: str = ""):
Expand All @@ -87,7 +87,7 @@ def _cmd_explain_item(self, item: str = ""):
return

self.ctx.previous_explanation = expl
logger.info(str(expl).strip())
self.ctx.ui.print_json(parse_explanation(expl))

@mark_raw
def _cmd_explain_missing(self, location: str = ""):
Expand Down Expand Up @@ -132,8 +132,7 @@ def _cmd_more(self, index: str = ""):
return

self.ctx.previous_explanation = expl

logger.info(str(expl).strip())
self.ctx.ui.print_json(parse_explanation(expl))

if not tracker_loaded:
del _cmd_explain
Expand Down Expand Up @@ -169,7 +168,7 @@ def setup_logic(self):

def parse_explanation(explanation: RuleExplanation) -> list[JSONMessagePart]:
result_regex = r"(\(|\)| & | -> | \| | \[.*\](?: ->)?\s*| \(\w+\)|\n\s*)"
splits = re.split(result_regex, str(explanation))
splits = re.split(result_regex, str(explanation).strip())

messages = []
for s in splits:
Expand Down

0 comments on commit 4738ce7

Please sign in to comment.