Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1773 +/- ##
=======================================
Coverage 99.75% 99.75%
=======================================
Files 23 23
Lines 6473 6473
=======================================
Hits 6457 6457
Misses 16 16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
Thanks for making this example. It works quite well, but I did run into one issue. After running enough commands where the prompt should display at the bottom of the screen, it instead is hidden outside the CLI panel. |
|
Thanks for catching this, I can reproduce it. The I moved the border to a wrapping container in a35a055, so the PTY now matches the visible area (26 rows, cursor on row 25 after 40 commands). |
Adds
examples/textual_tty_embed.py, showing how to embed a cmd2 app in a Textual app with textual-tty, with a realtime status panel next to the terminal.--cmd2-only) in a textual-ttyTerminal, so the cmd2 app is a plain prompt-toolkit app that doesn't know it's embedded.set_window_title()from precmd / command finalization hooks. TheTerminal.TitleChangedmessage updates the panel, so no extra IPC is needed. A Textual-driven clock panel updates independently.uv run --with textual-tty examples/textual_tty_embed.py.examples/README.md.Tested headless with Textual's Pilot (textual 8.2.8, textual-tty 0.4.0, Linux): typing commands into the embedded terminal shows cmd2's output, and the status panel goes idle -> running -> idle with the command count updated.
make test,make mypy,make docs-testand the prek hooks pass.Note that textual-tty is still pre-alpha, so the example may need small updates if its API changes. Happy to adjust the approach (e.g. a socket instead of the window title) if you prefer.
Closes #1771