mikaelmello / inquire

A Rust library for building interactive prompts
https://docs.rs/inquire
MIT License
1.71k stars 72 forks source link

Automate terminal recordings for documentation #53

Open mikaelmello opened 2 years ago

mikaelmello commented 2 years ago

Is your feature request related to a problem? Please describe.

Generating each recording is a boring process with a lot of manual changes required. The recordings are even a bit outdated on functionality just because I didn't want to re-record everything which would require a lot of time.

Describe the solution you'd like

Have a set of recordings each containing the example to run and a series of keystrokes to perform.

Then automatically run these examples with the provided keystrokes, recording the terminal output and generating .cast and .gif outputs.

Describe alternatives you've considered

I thought of recording the keystrokes to give it a more natural feel but sometimes that's worse. For example when the recorder (I) take too long for the next action or type too fast worsening UX. Executing the keystrokes at a constant interval seems good enough.

b3nj5m1n commented 1 year ago

Just in case you're not already aware of it, vhs was made for exactly this.

Here's a quick example:

Sleep 1s
Type 'cargo run --example date --features "date macros"'
Sleep 1s
Enter
Set TypingSpeed 1s
Sleep 1s
Type "KKKKKKK"
Sleep 500ms
Type "HHHHHjjhh"
Enter
Sleep 1.5s
Escape
Sleep 500ms
Escape 3
Sleep 500ms
vhs < demo.tape

out