-
-
Notifications
You must be signed in to change notification settings - Fork 323
docs: add VHS-based interactive screenshot generation #1862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
docs: add VHS-based interactive screenshot generation #1862
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1862 +/- ##
=======================================
Coverage 97.98% 97.98%
=======================================
Files 60 60
Lines 2686 2686
=======================================
Hits 2632 2632
Misses 54 54 ☔ View full report in Codecov by Sentry. |
|
lol. I found that I can't edit this PR title name after I created it. |
|
not really a feat (at least not to commitizen itself), so I changed it to docs |
I heard from my friend that some github preview features have so terrible UI that people cannot find where to edit the PR title. |
bearomorphism
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution of this great documentation improvement! The new gifs look beautiful!
Nothing is really blocking this PR but the comments related to demo.gif.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please replace all occurrences of
demo.gifin the docs with this and removedemo.gif. - Maybe put all vhs generated file under some dedicated folder, for example,
docs/images/vhs/, and put all*.tapefiles outsideimages/directory since they are just data for generating the .gif files.
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add docs/images/cli_help | ||
| git add docs/images/cli_help docs/images/*.gif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can put all files generated by the command in a dedicated folder.
| # VHS documentation https://github.com/charmbracelet/vhs | ||
| # | ||
| # Output: | ||
| # Output <path>.gif Create a GIF output at the given <path> | ||
|
|
||
| # | ||
| # Settings: | ||
| # Set FontSize <number> Set the font size of the terminal | ||
| # Set FontFamily <string> Set the font family of the terminal | ||
| # Set Height <number> Set the height of the terminal | ||
| # Set Width <number> Set the width of the terminal | ||
| # Set LetterSpacing <float> Set the letter spacing of the terminal | ||
| # Set LineHeight <float> Set the line height of the terminal | ||
| # Set Theme <json|string> Set the theme of the terminal | ||
| # Set Padding <number> Set the padding of the terminal | ||
| # Set TypingSpeed <time> Set the typing speed of the terminal | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need these comments?
| # VHS documentation https://github.com/charmbracelet/vhs | ||
| # | ||
| # Output: | ||
| # Output <path>.gif Create a GIF output at the given <path> | ||
|
|
||
| # | ||
| # Settings: | ||
| # Set FontSize <number> Set the font size of the terminal | ||
| # Set FontFamily <string> Set the font family of the terminal | ||
| # Set Height <number> Set the height of the terminal | ||
| # Set Width <number> Set the width of the terminal | ||
| # Set LetterSpacing <float> Set the letter spacing of the terminal | ||
| # Set LineHeight <float> Set the line height of the terminal | ||
| # Set Theme <json|string> Set the theme of the terminal | ||
| # Set Padding <number> Set the padding of the terminal | ||
| # Set TypingSpeed <time> Set the typing speed of the terminal | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
| """Generate GIF screenshots for interactive commands using VHS.""" | ||
| images_root = Path(__file__).parent.parent / "docs" / "images" | ||
|
|
||
| vhs_files = ["init.tape", "commit.tape"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hard-coding the tape files, we can just list all *.tape files under the dedicated folder and process them. Also, we don't need to check the existence of vhs_path in the following for loop if we use this approach.
|
|
||
| for vhs_file in vhs_files: | ||
| vhs_path = images_root / vhs_file | ||
| if vhs_path.exists(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_file() should be used if you want to check whether a file exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either rename this file or make your change a separate script. I prefer to make it a separate script.
|
As a follow up, this can also be used to regenerate |
Description
This PR adds support for generating interactive GIF screenshots for
cz initandcz commitcommands using VHS (Video Home System), a tool for generating terminal GIFs from code.Why VHS?
VHS is a modern tool for generating terminal recordings as GIFs.
Benefits:
Checklist
Was generative AI tooling used to co-author this PR?
Code Changes
uv run poe alllocally to ensure this change passes linter check and testspython scripts/gen_cli_help_screenshots.pylocallyinit.gifandcommit.gifare generated correctlygen_cli_help_screenshots()function unchangedExpected Behavior
Local Generation: Running
python scripts/gen_cli_help_screenshots.pyshould generate:docs/images/cli_help/(CLI help screenshots)docs/images/init.gif(interactive demo ofcz init)docs/images/commit.gif(interactive demo ofcz commit)CI/CD: When documentation workflow runs:
Steps to Test This Pull Request
Prerequisites
Local Testing
Additional Context