Return True if import may proceed; False if user cancelled.
(clear: bool, yes: bool)
| 660 | db_manager.close_driver() |
| 661 | |
| 662 | def _confirm_bundle_clear(clear: bool, yes: bool) -> bool: |
| 663 | """Return True if import may proceed; False if user cancelled.""" |
| 664 | if not clear: |
| 665 | return True |
| 666 | console.print("[yellow]⚠️ Warning: This will clear all existing graph data![/yellow]") |
| 667 | if yes: |
| 668 | return True |
| 669 | if not sys.stdin.isatty(): |
| 670 | console.print( |
| 671 | "[bold red]Refusing to clear graph in non-interactive mode. " |
| 672 | "Pass --yes / -y to confirm.[/bold red]" |
| 673 | ) |
| 674 | raise typer.Exit(code=1) |
| 675 | if not typer.confirm("Are you sure you want to continue?", default=False): |
| 676 | console.print("[yellow]Import cancelled[/yellow]") |
| 677 | return False |
| 678 | return True |
| 679 | |
| 680 | |
| 681 | @bundle_app.command("import") |