Commit 776d67c
authored
feat: add interactive prompt for video generation (#298)
## Summary
After finishing a recording, t-rec now prompts users to generate an MP4
video in addition to the GIF. This provides a convenient way to get both
formats without needing to re-record or remember to pass `--video`
upfront.
The prompt runs in a background thread, so users can answer while the
GIF is being generated - no wasted waiting time.
### User Experience
After the GIF generation message appears, users see:
```
🎉 🚀 Generating t-rec.gif
🎬 Also generate MP4 video? (y/n) ›
(auto-skip in 15s)
```
- Press `y` to generate MP4 (no Enter required)
- Press `n` to skip (no Enter required)
- Wait 15 seconds to auto-skip
### When the prompt is skipped
- **Quiet mode** (`-q`): No prompt, respects automation needs
- **Non-interactive** (piped input, CI): Returns "no" automatically
- **Already requested video**: If `--video` or `--video-only` was used,
video generates without prompting
### Implementation
- Uses `dialoguer` crate for cross-platform terminal input handling
- Prompt runs in background thread while GIF generates
- 15-second countdown displayed below the prompt
Closes #219
## Test plan
- [x] Run `t-rec`, wait for prompt, press `y` → video generated
- [x] Run `t-rec`, wait for prompt, press `n` → no video
- [x] Run `t-rec`, wait 15 seconds → timeout, no video
- [x] Run `t-rec --video` → no prompt, video generated
- [x] Run `t-rec --video-only` → no prompt, only video
- [x] Run `t-rec -q` → no prompt (quiet mode)
- [ ] Run `echo "" | t-rec` → no prompt (non-interactive)
---------
Signed-off-by: Sven Kanoldt <sven@d34dl0ck.me>1 parent d586965 commit 776d67c
File tree
8 files changed
+604
-10
lines changed- features
- src
- generators
8 files changed
+604
-10
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
282 | 305 | | |
283 | 306 | | |
284 | 307 | | |
| |||
0 commit comments