跳到正文

tamnd

ascii-gif

Turn a terminal session into a good-looking animated GIF. A vhs wrapper with an attractive default look.

README 已保存到本站,可直接阅读

Documentation snapshot

README 快照

这篇是英文原文

下面正文是项目自己的英文 README。想读全文就用浏览器自带的整页翻译: Chrome / Edge 点地址栏右侧的翻译图标,或用右键菜单里的「翻译成中文」; 手机浏览器一般在菜单里。

本页保存的是公开项目资料快照,阅读过程不需要连接 GitHub。

ascii-gif

图片:CI 图片:Release 图片:Go Reference 图片:License

Turn a terminal session into a good-looking animated GIF. You write the action, ascii-gif supplies the window chrome, theme, and framing.

It wraps vhs as a Go library and prepends an attractive default look, so a tape only carries the part you care about: the commands, the typing, the pauses.

Install • Quickstart • Tapes • Library

Install

go install github.com/tamnd/ascii-gif/cmd/ascii-gif@latest

ascii-gif drives two runtime tools the way vhs does: ttyd runs your commands in a real terminal and ffmpeg encodes the frames. Install both, then check:

# macOS
brew install ttyd ffmpeg

ascii-gif doctor

Quickstart

ascii-gif init demo          # write demo.tape you can edit
ascii-gif render demo.tape   # render demo.gif

A tape is a small script of terminal actions. The starter looks like this:

# A tape is a script. ascii-gif prepends the look, you write the action.
Type "echo hello from ascii-gif"
Enter
Sleep 2s

Render it to a GIF, choosing the output path:

ascii-gif render demo.tape -o out/hello.gif

Tapes

A tape uses the vhs tape language: Type, Enter, Sleep, Hide/Show, and more. See the vhs command reference for the full set. ascii-gif adds the look for you, so you do not write the Set header. The default look is a colored margin, a window bar, a rounded border, and a readable theme and font.

Two flags change how the look is applied:

-o, --output     GIF path to write (default: the tape name with .gif)
    --no-preset  do not prepend the look; the tape stands on its own
-q, --quiet      suppress vhs progress output

Pass --no-preset when a tape carries its own Set header and you want full control.

Read a tape from stdin with -:

echo 'Type "date"; Enter; Sleep 1s' | ascii-gif render -

Library

The renderer is a small package you can call from Go. Give it a tape body and it composes the look, runs vhs, and writes the GIF:

import "github.com/tamnd/ascii-gif/asciigif"

err := asciigif.Render(ctx, `Type "echo hi"
Enter
Sleep 1s
`, asciigif.Options{Output: "hi.gif"})

asciigif.CheckDeps reports whether ttyd and ffmpeg are on PATH, which is what ascii-gif doctor calls.

Credit

The heavy lifting is vhs by Charm. ascii-gif is a thin wrapper over a library-ized fork of it that adds a default look and a smaller surface.

License

MIT. See LICENSE.

Official distribution

获取与安装

暂未发现可确认的官方软件包地址

当前 README 快照没有出现 npm、PyPI、Crates.io、pub.dev 等官方包页链接。本站不会根据仓库名称猜测下载地址。

本站不托管项目文件;需要安装时,请以项目维护者发布的官方文档为准。

使用前核验

本站保存公开资料用于阅读,不代表安全审计或功能背书。安装前请核对许可证、依赖来源和发布签名,不要直接运行来源不明的二进制文件或高权限脚本。