

Discover more from hrbrmstr's Daily Drop
We're back at the CLI today, focusing our gaze upon three tools to help you craft engaging narratives from the terminal (or just get stuff done).
TL;DR
This is an AI-generated summary of today's Drop.
I used the same prompt and service as yesterday. Zero editing required
YouPlot: A Ruby-based command-line tool for creating visually appealing plots, graphs, and charts directly in your terminal. It supports various types of plots and works with data from standard input or specified files. YouPlot GitHub Repository
Slides: A terminal-based presentation tool that allows you to define slide decks in a familiar markdown format and serve them up interactively or make them available via anonymous SSH. It supports code block execution and has full navigation controls. Slides GitHub Repository
VHS: A utility by Charmbracelet that enables you to record, generate, and playback terminal sessions in the form of GIFs or videos. It simplifies the process of creating visual demonstrations of command-line interactions and supports a variety of commands for controlling the recording. VHS GitHub Repository
YouPlot
YouPlot is a Ruby-based command-line tool that enables you to create visually appealing plots, graphs, and charts directly in your terminal. It is designed to work with data from standard input or specified files, supporting various types of plots, including bar, line, scatter, box plots, histograms, and density plots. It also has sane defaults, so what you create will most likely look pretty solid without further customization.
Usage is super straightforward, and there are many examples in the repo. Here's another one using yesterday's “superhero” dataset (remotely, via DuckDB) to see what the dominant “super” eye color is:
$ duckdb -column \
-c "install httpfs;
load httpfs;
select
eye_color
from
'https://rud.is/dl/superheroes.parquet'
where
eye_color != ''" |
uplot count -t "The Eyes Have It"
(output is in the section header)
This is very handy when you're at the CLI and need to visualize some data you're working with and do not want to switch modalities. It's also handy for creating charts to use in text-based presentations. I can't imagine why I would note that…
Slides
If we can put charts in the terminal, why not entire slide decks?!
Slides (GH) is a terminal-based presentation tool that lets you define a deck in a familiar markdown format (it's similar to Qmd/Rmd/Reveal decks) and serve it up interactively, yourself, or make them available via anonymous SSH.
You'll see it in action in the final section's header, so we can afford to take some space to give a peek at the format (in the event some folks do not use markdown slides):
---
author: "@hrbrmstr"
date: "2023-08-24"
paging: "Slide %d / %d"
theme: "dracula.json"
---
# Welcome To The Daily Drop
_Edition: #325 (2023-08-24)_
Topics:
- YouPlot
- Slides
- VHS
---
(The dracula.json
is a glamour theme.)
Full navigation controls are baked in, as is the ability to search across slides interactively.
Slides also supports code block execution, either in situ, or via pre-rendering before the deck is presented. For now, you're limited to:
bash
zsh
fish
elixir
go
javascript
python
ruby
perl
rust
java
cpp
swift
dart
v
for those code blocks, but the Golang code is super readable, so it should not be difficult to add support for others (I may try to do that for R, or perhaps we can do it together tomorrow?).
When you start a slideshow, Slides watches the file for changes and will re-render things on the fly, which is super-handy when you're iterating on a deck.
It's a very clever tool and pairs nicely with what's in the last section.
You can tap through the presentation I made for the video in the last section via:
$ ssh thats.hrbrmstr.dev -p53531
VHS
Charmbracelet's VHS utility is a spiffy tool that allows you to record, generate, and playback terminal sessions in the form of GIFs or videos. It simplifies the process of creating visual demonstrations of command-line interactions, which can be useful for READMEs, tutorials, or integration tests. Moreover, VHS addresses the challenge of effectively demonstrating command-line interactions in a visual and engaging manner. Traditional methods, such as static screenshots or manually recorded screencasts, can be time-consuming to create and update. VHS simplifies this process by allowing you to define the desired terminal interactions via “commands” in what the devs call a .tape
file, which can be easily modified and re-recorded as needed.
There are a few basic types of VHS commands:
Output <path>
: specify file outputRequire <program>
: specify required programs for tape fileSet <Setting> Value
: set recording settingsType "<characters>"
: emulate typingLeft
Right
Up
Down
: arrow keysBackspace
Enter
Tab
Space
: special keysCtrl[+Alt][+Shift]+<char>
: press control + key and/or modifierSleep <time>
: wait for a certain amount of timeHide
: hide commands from outputShow
: stop hiding commands from outputScreenshot
: screenshot the current frame
The Charmbracelet folks have an extensive set of examples which will look much better on GH than they will here, but these are the first few lines of the slides.md
one which produced the video in the section header:
Output slides.mp4
Output slides.gif
Set FontSize 32
Set Padding 0
Set Framerate 1
Set Width 1600
Set Height 1200
Hide
Type "./slides.md"
Enter
Show
Sleep 1s
Type@1s "n"
Sleep 1s
VHS allows you to publish your GIFs to our servers for easy sharing with your friends and colleagues. Specify which file you want to share, then use the publish
sub-command to host it on vhs.charm.sh
. The output will provide you with links to share your GIF via browser, HTML, and Markdown.
As if all this is not sufficiently cool, VHS also has a built-in SSH server. When you self-host VHS you can access it as though it were installed locally. VHS will have access to commands and applications on the host, so you don't need to install them on your machine.
And, they mean it when they say CI/CD, since they've provided a handy GitHub Action to add to your workflow.
The README has information on how to install VHS via a package manager. However, if you decide to embark on the go install …
journey, you'll need ttyd around, first. And, as usual, the Charmbracelet folks have extensive, rendered examples in that same README.
FIN
Today’s Drop was all sorts of fun to make. ☮