Closed seandenigris closed 2 years ago
This reminds me of the question on Stack Overflow titled “VT100 screen scraping interface for Smalltalk”. I’m not sure if that’s what you’re looking for, and the internals of TerminalEmulator don’t seem designed to facilitate screen scraping, but I guess you could still create a subclass in which you override ‘openInWorld’ to do nothing (just return ‘self’). Then the following will not show the morph, but will still give you a TerminalEmulatorTextState with the output of the first example command:
term := TerminalEmulatorNoOpen openBash.
term model session tail nextPutAllCr: 'tput setaf 1; printf "%s " Hello; tput setaf 2; printf "%s\n" World; tput sgr0'.
"term model session tail nextPutAllCr: 'exit'."
term tty lineAt: 3
I think something like your example might work well. I guess if I find the time I could extract the interface parts from the display parts, but I don't mind starting with something simple. I'll close for now and report any updates here.
Is it possible to use PTerm without the GUI? I'm on GT and would still like to use it from, say, a playground.
I tried:
but got:
I guess I could just let the window open in Morphic and ignore it. Although it seems it's not so easy to get ahold of the underlying model. This is the best I could come up with:
Is there a better way?