Return True if import may proceed; False if user cancelled.
(clear: bool, yes: bool)
| 756 | db_manager.close_driver() |
| 757 | |
| 758 | def _confirm_bundle_clear(clear: bool, yes: bool) -> bool: |
| 759 | """Return True if import may proceed; False if user cancelled.""" |
| 760 | if not clear: |
| 761 | return True |
| 762 | console.print("[yellow]⚠️ Warning: This will clear all existing graph data![/yellow]") |
| 763 | if yes: |
| 764 | return True |
| 765 | if not sys.stdin.isatty(): |
| 766 | console.print( |
| 767 | "[bold red]Refusing to clear graph in non-interactive mode. " |
| 768 | "Pass --yes / -y to confirm.[/bold red]" |
| 769 | ) |
| 770 | raise typer.Exit(code=1) |
| 771 | if not typer.confirm("Are you sure you want to continue?", default=False): |
| 772 | console.print("[yellow]Import cancelled[/yellow]") |
| 773 | return False |
| 774 | return True |
| 775 | |
| 776 | |
| 777 | @bundle_app.command("import") |