Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Automate keypresses



On Sat, Mar 30, 2019 at 9:49 AM Christian K <syphdias@xxxxxxxxx> wrote:
>
> I'm trying to automate a benchmark for prompt render times with
> https://github.com/romkatv/zsh-prompt-benchmark. This requires a pressed
> Enter key to work.
>
> Is there a way so simulate key presses without using something like expect?

Since this is expected to run in an interactive shell, you probably
want something like this:

benchmark-prompt() {
  # adjust number of repeats as necessary
  repeat 100 zle -U $'\n'
  zle -U $'zsh-prompt-benchmark 5 0\n'
}
zle -N benchmark-prompt

Then invoke with M-x benchmark-prompt RET



Messages sorted by: Reverse Date, Date, Thread, Author