Skip to content

Commit

Permalink
Make cli.echo more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
skullydazed committed Jan 25, 2025
1 parent f1b8dc5 commit 80b6df4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion milc/milc.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ def echo(self, text: str, *args: Any, **kwargs: Any) -> None:
if args and kwargs:
raise ValueError('You can only specify *args or **kwargs, not both!')

# FIXME: For V2, when we can break backwards compatibility, format_ansi first and then do the %-formatting
if args:
text = format_ansi(text % args)
else:
elif kwargs:
text = format_ansi(text % kwargs)
else:
text = format_ansi(text)

if not self.config.general.color:
text = ansi_escape.sub('', text)
Expand Down

0 comments on commit 80b6df4

Please sign in to comment.