diff --git a/muxplex/cli.py b/muxplex/cli.py index 74ee75e..b088ff4 100644 --- a/muxplex/cli.py +++ b/muxplex/cli.py @@ -264,6 +264,15 @@ def doctor() -> None: f" {warn_mark} Settings: {SETTINGS_PATH} (not yet created — will use defaults)" ) + # Serve config + from muxplex.settings import load_settings # noqa: PLC0415 + + cfg = load_settings() + print( + f" {ok_mark} Serve config: {cfg['host']}:{cfg['port']}" + f" (auth={cfg['auth']}, ttl={cfg['session_ttl']}s)" + ) + # Auth status pw_path = get_password_path() if pam_available(): @@ -314,7 +323,7 @@ def doctor() -> None: ) else: print( - f" {warn_mark} Service: not installed (run: muxplex install-service)" + f" {warn_mark} Service: not installed (run: muxplex service install)" ) else: systemd_user = Path.home() / ".config" / "systemd" / "user" / "muxplex.service" @@ -326,7 +335,7 @@ def doctor() -> None: ) else: print( - f" {warn_mark} Service: not installed (run: muxplex install-service)" + f" {warn_mark} Service: not installed (run: muxplex service install)" ) print() # trailing newline diff --git a/muxplex/tests/test_cli.py b/muxplex/tests/test_cli.py index 8899edc..e6ddf22 100644 --- a/muxplex/tests/test_cli.py +++ b/muxplex/tests/test_cli.py @@ -1003,3 +1003,25 @@ def test_help_shows_single_upgrade_line(): "upgrade and update must appear as alias notation 'upgrade (update)', not two separate entries. " f"Got help text:\n{help_text}" ) + + +def test_doctor_shows_serve_config(tmp_path, monkeypatch, capsys): + """doctor() must show the current serve config (host, port, auth).""" + import json + + import muxplex.settings as settings_mod + + settings_file = tmp_path / "settings.json" + settings_file.write_text( + json.dumps({"host": "0.0.0.0", "port": 9999, "auth": "password"}) + ) + monkeypatch.setattr(settings_mod, "SETTINGS_PATH", settings_file) + + from muxplex.cli import doctor + + doctor() + + out = capsys.readouterr().out + assert "0.0.0.0" in out + assert "9999" in out + assert "password" in out