Display current configuration in a nice table.
()
| 717 | |
| 718 | |
| 719 | def show_config(): |
| 720 | """Display current configuration in a nice table.""" |
| 721 | created = ensure_config_file() |
| 722 | if created: |
| 723 | console.print( |
| 724 | f"[green]🆕 Created default configuration at {CONFIG_FILE}[/green]\n" |
| 725 | ) |
| 726 | config = load_config() |
| 727 | |
| 728 | # Separate database credentials from configuration |
| 729 | db_creds = {k: v for k, v in config.items() if k in DATABASE_CREDENTIAL_KEYS} |
| 730 | config_settings = {k: v for k, v in config.items() if k not in DATABASE_CREDENTIAL_KEYS} |
| 731 | |
| 732 | # Show database credentials if they exist |
| 733 | if db_creds: |
| 734 | console.print("\n[bold cyan]Database Credentials[/bold cyan]") |
| 735 | db_table = Table(show_header=True, header_style="bold magenta") |
| 736 | db_table.add_column("Credential", style="cyan", width=20) |
| 737 | db_table.add_column("Value", style="green", width=30) |
| 738 | |
| 739 | for key in sorted(db_creds.keys()): |
| 740 | value = db_creds[key] |
| 741 | # Mask password |
| 742 | if "PASSWORD" in key: |
| 743 | value = "********" if value else "(not set)" |
| 744 | db_table.add_row(key, value) |
| 745 | |
| 746 | console.print(db_table) |
| 747 | |
| 748 | # Show configuration settings |
| 749 | console.print("\n[bold cyan]Configuration Settings[/bold cyan]") |
| 750 | table = Table(show_header=True, header_style="bold magenta") |
| 751 | table.add_column("Setting", style="cyan", width=25) |
| 752 | table.add_column("Value", style="green", width=20) |
| 753 | table.add_column("Description", style="dim", width=50) |
| 754 | |
| 755 | for key in sorted(config_settings.keys()): |
| 756 | value = config_settings[key] |
| 757 | description = CONFIG_DESCRIPTIONS.get(key, "") |
| 758 | |
| 759 | # Highlight non-default values |
| 760 | if value != DEFAULT_CONFIG.get(key): |
| 761 | value_style = "[bold yellow]" + value + "[/bold yellow]" |
| 762 | else: |
| 763 | value_style = value |
| 764 | |
| 765 | table.add_row(key, value_style, description) |
| 766 | |
| 767 | console.print(table) |
| 768 | console.print(f"\n[cyan]Config file: {CONFIG_FILE}[/cyan]") |
| 769 | |
| 770 | |
| 771 | # ============================================================================= |
nothing calls this directly
no test coverage detected