-
-
Notifications
You must be signed in to change notification settings - Fork 334
Expand file tree
/
Copy pathgen_cli_interactive_gifs.py
More file actions
39 lines (32 loc) · 1.2 KB
/
gen_cli_interactive_gifs.py
File metadata and controls
39 lines (32 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import subprocess
from pathlib import Path
def gen_cli_interactive_gifs() -> None:
"""Generate GIF screenshots for interactive commands using VHS."""
vhs_dir = Path(__file__).parent.parent / "docs" / "images"
output_dir = Path(__file__).parent.parent / "docs" / "images" / "cli_interactive"
output_dir.mkdir(parents=True, exist_ok=True)
vhs_files = list(vhs_dir.glob("*.tape"))
if not vhs_files:
print("No VHS tape files found in docs/images/, skipping")
return
for vhs_file in vhs_files:
print(f"Processing: {vhs_file.name}")
try:
subprocess.run(
["vhs", vhs_file.name],
check=True,
cwd=vhs_dir,
)
gif_name = vhs_file.stem + ".gif"
print(f"✓ Generated {gif_name}")
except FileNotFoundError:
print(
"✗ VHS is not installed. Please install it from: "
"https://github.com/charmbracelet/vhs"
)
raise
except subprocess.CalledProcessError as e:
print(f"✗ Error processing {vhs_file.name}: {e}")
raise
if __name__ == "__main__":
gen_cli_interactive_gifs()