Skip to content
11 changes: 11 additions & 0 deletions src/tacomail/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ def wait(
filter_pattern: Optional[str] = typer.Option(
None, "--filter", "-f", help="Filter by subject or sender (regex pattern)"
),
print_body: bool = typer.Option(
False, "--print-body", "-p", help="Also print email body"
),
) -> None:
"""Wait for a new email to arrive.

Expand Down Expand Up @@ -491,6 +494,14 @@ def filter_fn(email_obj: Email) -> bool:
console.print("\n[green]✓ Email received![/green]")
console.print(f" From: {email_obj.from_.name} <{email_obj.from_.address}>")
console.print(f" Subject: {email_obj.subject}")

# Print email body if requested
if print_body:
if email_obj.body.text:
console.print("\n[bold]Email Body:[/bold]")
console.print(f"{email_obj.body.text}")
else:
console.print("\n[dim]No text body available[/dim]")
else:
console.print("\n[yellow]⏱ Timeout: No email received[/yellow]")
raise typer.Exit(1)
Expand Down