Skip to content

Commit

Permalink
Fix ColorArgumentParser to color errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Jan 29, 2025
1 parent 984ca14 commit 16d9282
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions skore/src/skore/cli/color_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,13 @@ def print_help(self, file=None):
"""Print the help message."""
console = Console(file=file)
console.print(self.format_help())

def error(self, message):
"""Print error message with Rich formatting and exit."""
console = Console(stderr=True, theme=skore_console_theme)
console.print(f"[red bold]error:[/red bold] {message}")

console.print(f"\n{self.format_usage()}")

console.print("\nFor more information, try '[cyan]--help[/cyan]'")
self.exit(2)

0 comments on commit 16d9282

Please sign in to comment.