Skip to content

Commit 2238542

Browse files
taylaandclaude
andcommitted
fix: register tui command in studyctl CLI
The StudyCards TUI tab was built but the 'studyctl tui' command wasn't registered in cli.py. Added the command with: - Textual import with graceful ImportError handling - Config loading for review.directories from config.yaml - Help text showing key bindings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 68f0fce commit 2238542

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

  • packages/studyctl/src/studyctl

‎packages/studyctl/src/studyctl/cli.py‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,3 +1189,38 @@ def docs_read(page: str) -> None:
11891189
console.print("\n[yellow]Stopped reading[/yellow]")
11901190
except subprocess.TimeoutExpired:
11911191
console.print("\n[yellow]Reading timed out[/yellow]")
1192+
1193+
1194+
# ── TUI ──────────────────────────────────────────────────────────────────────
1195+
1196+
1197+
@cli.command()
1198+
def tui() -> None:
1199+
"""Launch the interactive study dashboard (requires textual).
1200+
1201+
Install: uv pip install 'studyctl[tui]'
1202+
1203+
Key bindings: f=flashcards, z=quiz, d=dashboard, q=quit, v=voice toggle
1204+
"""
1205+
try:
1206+
from studyctl.tui.app import StudyApp
1207+
except ImportError:
1208+
console.print(
1209+
"[red]The TUI requires 'textual'.[/red]\n"
1210+
"Install: uv pip install 'studyctl[tui]'"
1211+
)
1212+
return
1213+
1214+
import yaml
1215+
1216+
config_path = Path.home() / ".config" / "studyctl" / "config.yaml"
1217+
study_dirs: list[str] = []
1218+
if config_path.exists():
1219+
try:
1220+
data = yaml.safe_load(config_path.read_text()) or {}
1221+
study_dirs = data.get("review", {}).get("directories", [])
1222+
except Exception:
1223+
pass
1224+
1225+
app = StudyApp(study_dirs=study_dirs)
1226+
app.run()

0 commit comments

Comments
 (0)