From 45d525cc6829bcfb5a3e4035f8a1276c906992b1 Mon Sep 17 00:00:00 2001 From: Kasturi Rajarampatil Date: Sun, 7 Jun 2026 15:35:24 +0530 Subject: [PATCH 1/2] removed typer from state.py --- trushell/state.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/trushell/state.py b/trushell/state.py index 86b53d3..72b79d3 100644 --- a/trushell/state.py +++ b/trushell/state.py @@ -4,8 +4,6 @@ from dataclasses import dataclass from datetime import datetime from pathlib import Path - -import typer from platformdirs import user_config_dir @@ -60,8 +58,11 @@ def load(self) -> AppState: state.z_dirs = file_data.get("z_dirs", {}) except FileNotFoundError: return state - except Exception: - typer.secho("Unable to load application state. Using defaults.", fg=typer.colors.YELLOW) + except Exception as e: + print( + f"[yellow]Warning: Unable to load application state. " + f" Using defaults.{e}[/yellow]" + ) return state return state From 449f055918c3022aff2eca83ffaac63d21689b65 Mon Sep 17 00:00:00 2001 From: Kasturi Rajarampatil Date: Sun, 7 Jun 2026 17:56:56 +0530 Subject: [PATCH 2/2] fix:droped argv lowercase and added dirty_settings test --- tests/test_settings.py | 8 ++++++++ trushell/cli.py | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_settings.py b/tests/test_settings.py index 7b1f6c5..a3c93de 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -41,3 +41,11 @@ def fake_run(self, *args, **kwargs): run_settings("") assert called["ran"] is True + +def test_switching_categories_retains_dirty_settings(tmp_path, monkeypatch): + monkeypatch.setattr(Path, "home", lambda: tmp_path) + app = SettingsApp() + app._update_dirty_setting("theme", "light") + app.selected_category = "Data" + assert "theme" in app.dirty_settings + assert app.dirty_settings["theme"] == "light" \ No newline at end of file diff --git a/trushell/cli.py b/trushell/cli.py index ae6f9bc..16e2e27 100644 --- a/trushell/cli.py +++ b/trushell/cli.py @@ -31,8 +31,7 @@ def app_with_lower() -> None: if len(sys.argv) > 1: # Create a local copy to avoid mutating the global sys.argv argv_copy = sys.argv.copy() - argv_copy[1] = argv_copy[1].lower() - if argv_copy[1] not in {"--help", "-h", "version"}: + if argv_copy[1].lower() not in {"--help", "-h", "version"}: raw = " ".join(argv_copy[1:]) get_kernel().execute_command(raw) return