@@ -37,8 +37,37 @@ def _export_cmd_as_svg(cmd: str, file_path: Path) -> None:
3737 print ("Saved to:" , file_path .as_posix ())
3838
3939
40- # TODO: generate the screenshot of cz init interactive mode
41- # TODO: generate the screenshot of cz commit interactive mode
40+ def gen_interactive_screenshots () -> None :
41+ """Generate GIF screenshots for interactive commands using VHS."""
42+ images_root = Path (__file__ ).parent .parent / "docs" / "images"
43+
44+ vhs_files = ["init.tape" , "commit.tape" ]
45+
46+ for vhs_file in vhs_files :
47+ vhs_path = images_root / vhs_file
48+ if vhs_path .exists ():
49+ print (f"Processing VHS file: { vhs_file } " )
50+ try :
51+ subprocess .run (
52+ ["vhs" , str (vhs_path )],
53+ check = True ,
54+ cwd = images_root .as_posix (),
55+ )
56+ gif_file = vhs_file .replace (".tape" , ".gif" )
57+ print (f"✓ Generated { gif_file } from { vhs_file } " )
58+ except subprocess .CalledProcessError as e :
59+ print (f"✗ Error processing { vhs_file } : { e } " )
60+ raise
61+ except FileNotFoundError :
62+ print (
63+ "VHS is not installed. Please install it from: "
64+ "https://github.com/charmbracelet/vhs"
65+ )
66+ raise
67+ else :
68+ print (f"Warning: { vhs_file } not found, skipping" )
69+
4270
4371if __name__ == "__main__" :
4472 gen_cli_help_screenshots ()
73+ gen_interactive_screenshots ()
0 commit comments