diff --git a/src/apm_cli/commands/config.py b/src/apm_cli/commands/config.py index 7794ce20..9108f2fe 100644 --- a/src/apm_cli/commands/config.py +++ b/src/apm_cli/commands/config.py @@ -147,7 +147,7 @@ def get(key): apm config get auto-integrate apm config get """ - from ..config import get_config, get_auto_integrate + from ..config import get_auto_integrate logger = CommandLogger("config get") if key: @@ -162,12 +162,8 @@ def get(key): ) sys.exit(1) else: - # Show all config - config_data = get_config() + # Show all user-settable keys with their effective values (including + # defaults). Iterating raw config keys would hide settings that + # have not been written yet (e.g. auto_integrate on a fresh install). logger.progress("APM Configuration:") - for k, v in config_data.items(): - # Map internal keys to user-friendly names - if k == "auto_integrate": - click.echo(f" auto-integrate: {v}") - else: - click.echo(f" {k}: {v}") + click.echo(f" auto-integrate: {get_auto_integrate()}") diff --git a/tests/unit/test_config_command.py b/tests/unit/test_config_command.py index d9944e76..6fff7410 100644 --- a/tests/unit/test_config_command.py +++ b/tests/unit/test_config_command.py @@ -225,19 +225,19 @@ def test_get_unknown_key(self): def test_get_all_config(self): """Show all config when no key is provided.""" - fake_config = {"auto_integrate": True, "default_client": "vscode"} - with patch("apm_cli.config.get_config", return_value=fake_config): + with patch("apm_cli.config.get_auto_integrate", return_value=True): result = self.runner.invoke(config, ["get"]) assert result.exit_code == 0 assert "auto-integrate: True" in result.output + # Internal keys must not appear - users cannot set them via apm config set + assert "default_client" not in result.output - def test_get_all_config_unknown_key_passthrough(self): - """Unknown config keys are shown as-is.""" - fake_config = {"some_other_key": "value"} - with patch("apm_cli.config.get_config", return_value=fake_config): + def test_get_all_config_fresh_install(self): + """auto-integrate is shown even on a fresh install with no key in the file.""" + with patch("apm_cli.config.get_auto_integrate", return_value=True): result = self.runner.invoke(config, ["get"]) assert result.exit_code == 0 - assert "some_other_key: value" in result.output + assert "auto-integrate: True" in result.output class TestAutoIntegrateFunctions: