MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / show_config

Function show_config

src/codegraphcontext/cli/config_manager.py:752–805  ·  view source on GitHub ↗

Display current configuration in a nice table.

()

Source from the content-addressed store, hash-verified

750
751
752def show_config():
753 """Display current configuration in a nice table."""
754 created = ensure_config_file()
755 if created:
756 console.print(
757 f"[green]🆕 Created default configuration at {CONFIG_FILE}[/green]\n"
758 )
759 config = load_config()
760
761 # Separate database credentials from configuration
762 db_creds = {k: v for k, v in config.items() if k in DATABASE_CREDENTIAL_KEYS}
763 config_settings = {k: v for k, v in config.items() if k not in DATABASE_CREDENTIAL_KEYS}
764
765 # Show database credentials if they exist
766 if db_creds:
767 console.print("\n[bold cyan]Database Credentials[/bold cyan]")
768 db_table = Table(show_header=True, header_style="bold magenta")
769 db_table.add_column("Credential", style="cyan", width=20)
770 db_table.add_column("Value", style="green", width=30)
771
772 for key in sorted(db_creds.keys()):
773 value = db_creds[key]
774 # Mask password
775 if "PASSWORD" in key:
776 value = "********" if value else "(not set)"
777 db_table.add_row(key, value)
778
779 console.print(db_table)
780
781 # Show configuration settings
782 console.print("\n[bold cyan]Configuration Settings[/bold cyan]")
783 table = Table(show_header=True, header_style="bold magenta")
784 table.add_column("Setting", style="cyan", width=25)
785 table.add_column("Value", style="green", width=20)
786 table.add_column("Description", style="dim", width=50)
787
788 for key in sorted(config_settings.keys()):
789 value = config_settings[key]
790 description = CONFIG_DESCRIPTIONS.get(key, "")
791
792 # Never print secret-like values (e.g. the HTTP API key) in plaintext.
793 if "API_KEY" in key.upper() and value:
794 value = "********"
795
796 # Highlight non-default values
797 if value != DEFAULT_CONFIG.get(key):
798 value_style = "[bold yellow]" + value + "[/bold yellow]"
799 else:
800 value_style = value
801
802 table.add_row(key, value_style, description)
803
804 console.print(table)
805 console.print(f"\n[cyan]Config file: {CONFIG_FILE}[/cyan]")
806
807
808# =============================================================================

Callers

nothing calls this directly

Calls 8

ensure_config_fileFunction · 0.85
load_configFunction · 0.85
printMethod · 0.80
itemsMethod · 0.80
add_columnMethod · 0.80
keysMethod · 0.80
add_rowMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected