feat: add asciicast v2 output format#711
Open
veeceey wants to merge 1 commit intocharmbracelet:mainfrom
Open
Conversation
Add support for .cast (asciicast v2) output format, allowing users to generate asciicast recordings alongside GIF/MP4/WebM outputs. The asciicast output captures terminal buffer snapshots during recording and writes them as asciicast v2 JSON Lines format with proper header and output events. Usage: Output demo.cast Closes charmbracelet#109
Author
Test ResultsAll existing tests pass with the new code. |
|
Great PR and indeed something a log of people were longing for! No snark, but may I ask why you chose to implement v2 instead of v3 of the asciicast file format? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for generating
.cast(asciicast v2) files as an output format, so you can do:This has been a requested feature since the early days (#109) - being able to export recordings as asciicast means you can use them with asciinema players, convert to SVG with svg-term-cli, or generate GIFs with agg.
How it works
Asciicastfield toVideoOutputsso.castis a first-class output alongside GIF/MP4/WebM.castoutput is requested to avoid overhead)GenerateAsciicastwrites the asciicast v2 JSON Lines format: a header line with version/width/height/timestamp, followed by"o"(output) events with deduplicated contentTesting
Closes #109