cape.tui Textual-based user interface to CAPE¶
OpenCode-style interactive terminal user interface to CAPE, built on
the optional textual package and launched with:
$ cape tui
It provides the same core features as cape.ui – CAPE-aware
tab-completion and a dedicated history file – inside a persistent app
with a scroll log, a pinned dark composer, and context below the prompt.
Ctrl-P opens a picker for the built-in TUI commands:
- In-process CAPE commands
Commands starting with
cape,pycart,pyfun, etc. run in-process usingcape.cfdx.cli.main(), with output streamed into the log; other commands run as subprocesses.
- Interruptions and prompts
Ctrl-C (or ESC) interrupts the running command, and interactive CAPE prompts mount as clickable widgets above the editor.
- TUI meta-commands
Commands starting with
:are handled by the TUI itself::help [<cmd>],:history [<n>],:!N,:status,:cd <dir>(plaincdalso works),:pwd,:clear, and:exit/:quit.
See cape.tui.tuiapp for the app itself and
cape.tui.tuiutils for the render helpers.
- cape.tui.main(cls: type | None = None) Tuple[int, dict]¶
Main Textual-based interactive TUI function
- Call:
>>> ierr, stats = main(cls)
- Inputs:
- cls: {
None} |type cape.argread.ArgReadersubtype for completions and:help; defaults tocape.cfdx.cli.CfdxFrontDesk
- cls: {
- Outputs:
- ierr:
int Return code
- stats:
dict Information about results of commands run
commands:intnumber of commands runfailures:intnumber of failed commandstui_commands:intnumber of TUI meta-cmdsduration:floatsession wall time (sec)json_files:tupleof loaded JSON paths, least to most recently usedlast_json_file:str|Nonemost recent absolute JSON pathlast_json_display_file:str|Nonepath displayed relative to the controller’s root
- ierr: