Show exit confirmation dialog. Returns: True to exit, False to continue
()
| 496 | |
| 497 | |
| 498 | def show_exit_confirmation() -> bool: |
| 499 | """ |
| 500 | Show exit confirmation dialog. |
| 501 | |
| 502 | Returns: |
| 503 | True to exit, False to continue |
| 504 | """ |
| 505 | from prompt_toolkit import prompt |
| 506 | from prompt_toolkit.formatted_text import HTML |
| 507 | from prompt_toolkit.styles import Style |
| 508 | |
| 509 | style = Style.from_dict({ |
| 510 | 'prompt': '#76B900 bold', |
| 511 | }) |
| 512 | |
| 513 | console.print("[yellow]⚠️ Exit RightNow CLI?[/yellow]") |
| 514 | console.print() |
| 515 | |
| 516 | while True: |
| 517 | try: |
| 518 | # Simple y/n prompt |
| 519 | answer = prompt( |
| 520 | HTML('<prompt> Exit? (y/n): </prompt>'), |
| 521 | style=style |
| 522 | ).strip().lower() |
| 523 | |
| 524 | if answer in ['y', 'yes']: |
| 525 | return True |
| 526 | elif answer in ['n', 'no', '']: |
| 527 | return False |
| 528 | else: |
| 529 | console.print("[dim]Please enter 'y' for yes or 'n' for no[/dim]") |
| 530 | |
| 531 | except (KeyboardInterrupt, EOFError): |
| 532 | # Second Ctrl+C or EOF = force exit |
| 533 | return True |
| 534 | |
| 535 | |
| 536 | def interactive_mode(orchestrator: AgentOrchestrator): |
no test coverage detected