Skip to content

Commit

Permalink
feat: add CLIInterface methods for message display
Browse files Browse the repository at this point in the history
This commit introduces methods in the CLIInterface class to handle different types of messages (info, error, success, warning). This centralizes message formatting and improves code readability in other files.
  • Loading branch information
runner committed Dec 25, 2024
1 parent 10f3967 commit 26364a7
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions aicmt/cli_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

class CLIInterface:
def __init__(self):
self.console = Console()
pass
# self.console = Console()

def display_welcome(self):
"""Display welcome message"""
Expand All @@ -24,10 +25,26 @@ def display_welcome(self):
)
)

def display_info(self, message: str):
@classmethod
def display_info(cls, message: str):
"""Display information message"""
console.print(f"[bold blue]{message}[/bold blue]")

@classmethod
def display_error(cls, message: str):
"""Display error message"""
console.print(f"[bold red]Error:[/bold red] {message}")

@classmethod
def display_success(cls, message: str):
"""Display success message"""
console.print(f"[bold green]✓[/bold green] {message}")

@classmethod
def display_warning(cls, message: str):
"""Display warning message"""
console.print(f"[bold yellow]⚠️[/bold yellow] {message}")

def display_changes(self, changes: list):
"""Display current unstaged changes"""
if not changes:
Expand Down Expand Up @@ -101,14 +118,6 @@ def confirm_push(self) -> bool:
except EOFError:
return False

def display_error(self, message: str):
"""Display error message"""
console.print(f"[bold red]Error:[/bold red] {message}")

def display_success(self, message: str):
"""Display success message"""
console.print(f"[bold green]✓[/bold green] {message}")

def display_repo_info(self, working_dir: str, branch: str):
"""Display repository information"""
console.print("\n[cyan]━━━ Git Repository Info ━━━[/cyan]")
Expand Down

0 comments on commit 26364a7

Please sign in to comment.