TL;DR How can I use python to ``simulate" typewriting commands in user's terminal? (something like the example below where I just really type the first command)
I am using asciinema for displaying demos of terminal session. But instead of recording my own keystrokes (which unfortunately are not constant speed, prone to mistakes,...), I would like to script them, so the goal is the same as https://stackoverflow.com/a/63080929/5913047. But most tools (at least the ones in the answer of https://stackoverflow.com/a/63080929/5913047) are not maintained, so I was wondering if I could come up with a python script to do it.
Problem, I have no idea how to simulate typewriting in the user's terminal, especially using the syntax coloring and prompt of the user's terminal. I am pretty sure it is possible, since it is done in asciiscript (unfortunately this tool is buggy, in a language I do not know and not maintained). So is it possible to write in user's terminal, using user's syntax coloring and prompt, with python?
I imagine it has something to do with subprocess
and pipes, but I have a hard time finding the information I need, and I am not too familiar with those.