Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/test_help_docs.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
from __future__ import annotations

import importlib
from types import SimpleNamespace

from trushell.commands.core import run_help


def test_run_help_prints_docstring_for_known_command(monkeypatch, capsys):
def _fake_import_module(path: str):
module = importlib.import_module(path.replace("/", ".").removesuffix(".py"))
return module
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

fake_kernel = SimpleNamespace(
registry={
"settings": {
"path": "trushell/commands/settings.py",
"function": "run_settings",
}
}
},
_import_module=_fake_import_module,
)

# Provide a minimal module object with the expected function and
Expand Down
3 changes: 0 additions & 3 deletions trushell/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ def app_with_lower() -> None:
if len(sys.argv) > 1:
argv_copy = sys.argv.copy()
if argv_copy[1].lower() not in {"--help", "-h", "version"}:
# Normalize the command name to lowercase for case-insensitive
# invocation, but preserve the case of subsequent arguments
# (e.g., filenames) which may be case-sensitive.
first = argv_copy[1].lower()
rest = argv_copy[2:]
raw = " ".join([first] + rest)
Expand Down
12 changes: 4 additions & 8 deletions trushell/commands/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,11 @@ def add_field(label_text: str, widget: Static | Input | Select | Switch) -> None
Input(value=str(self.dirty_settings.get("prompt_symbol", self.settings.get("prompt_symbol", "➜"))), id="prompt_symbol"),
)
elif current_cat == "Appearance":
add_field(
"Theme:",
Select(
options=self.THEME_OPTIONS,
value=str(self.dirty_settings.get("theme", self.settings.get("theme", "dark"))),
id="theme_selector",
),
select_widget = Select(
options=self.THEME_OPTIONS,
value=str(self.dirty_settings.get("theme", self.settings.get("theme", "dark"))),
id="theme_selector",
)
select_widget.watch_value(lambda value: self._track_change("theme", value))
add_field("Theme:", select_widget)
elif current_cat == "Navigation":
add_field(
Expand Down
Loading