paxtonhare / demo-magic

A handy shell script that enables you to write repeatable demos in a bash environment.
MIT License
1.64k stars 212 forks source link

REPL demo #28

Open rmonat opened 1 month ago

rmonat commented 1 month ago

Hi, I would like to run a demo in a REPL, such as the interactive python shell. My issue is that pe will wait for the end of the current command to go to the next, so just using pe for the REPL will not work. Is there any way to do that?

paxtonhare commented 1 month ago

Just pushed a repl function. Hope it helps.

rmonat commented 1 month ago

Thank you very much for your quick answer @paxtonhare. I was thinking about something where:

pe 'python3'
repl
pe "print(1 + .2)"
exit

Would allow pe to work inside the REPL too, do you think that would be possible?

paxtonhare commented 1 month ago

I'm not sure I follow. Can you elaborate? maybe show what the use case is?

rmonat commented 1 month ago

Sorry for being unclear. I would like to be able to produce commands through demo-magic both in the terminal interface and the underlying repl interface of, for example, python.

I would like to produce an output similar to https://asciinema.org/a/99317 using commands such as:

pe python
repl
pe "1+1"
pe "a=3"
pe "a"
pe "b=a*3"
pe "b"
pe "a*b"
pe "exit()"
exit