# Termsnap 📸
**Create SVGs from terminal output**
![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)
[![Crates.io](https://img.shields.io/crates/v/termsnap.svg)](https://crates.io/crates/termsnap)
[![Build status](https://github.com/tomcur/termsnap/workflows/CI/badge.svg)](https://github.com/tomcur/termsnap/actions)
Termsnap turns terminal output into vector graphics. It uses an in-memory
instance of [Alacritty](https://github.com/alacritty/alacritty) under the hood
to be compatible with many terminal control sequences.
## Usage
See `$ termsnap --help` for CLI usage documentation. For example, to run the
`ls` command and store the output in an SVG file, run:
```bash
$ termsnap -- ls -l > ./out.svg
```
## Examples
These examples are generated by [./scripts/examples.sh](scripts/examples.sh).
Note some of these examples send automated input to an interactive bash
session.
### Cowsay
```bash
$ termsnap --lines 9 --columns 28 -- cowsay Hello, world
```
![Termsnap output of the cowsay command saying "hello world"](./media/cow.svg)
### Neovim
```bash
# On exit, for some terminals, Neovim clears the terminal screen by swapping
# back to the main terminal screen buffer. The `--render-before-clear` argument
# renders the terminal screen as it was just prior to that swap occurring.
$ termsnap --lines 12 --columns 60 --term xterm-256color --render-before-clear -- nvim --clean ./scripts/example.py <