Description
I've been using a queue, as described at #519 (comment), to make it so that I can send text to a prompt programatically. For instance, I have a -c
startup flag that allows to run a command as the first prompt. I also use this in the bracketed paste handler, as described in that issue.
The way I've done this is to pass items in the command queue through a PipeInput and use that as the input to the cli when there is a queue (and a normal input=None
otherwise).
However, I'm not a fan of this approach, because it means that I have to manipulate the input command so that it gets accepted by the cli, for instance, by appending a key code that maps to accept_line
.
I would much rather just set the prompt text to the command manually, and have it accept immediately. Is there a way to do this? I basically want to cli.current_buffer.insert_text(command)
then have cli.run()
bypass the eventloop and do a quick exit.