Sequin
Human-readable ANSI series.
Sequin is a little energy that can assist you debug your CLIs and TUIs. It’s likewise excellent for explaining escape series you may not comprehend, and exploring what TUIs are doing under the hood.
There are lots more utilize cases too, like checking golden files such as the ones utilized by teatest to crystalize Bubble Tea output.
Are you utilizing Sequin in a fascinating method? We ‘d enjoy to find out about it.
Setup
Utilize a plan supervisor:
# macOS or Linux brew set up charmbracelet/tap/sequin # Arch Linux (btw) yay -S sequin-bin # Nix nix-shell -p nur.repos.charmbracelet.sequin Debian/Ubuntu sudo mkdir -p/ etc/apt/keyrings curl -fsSL https://repo.charm.sh/apt/gpg.key|sudo gpg– dearmor -o/ etc/apt/keyrings/ charm.gpg echo “deborah [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *”|sudo tee/ etc/apt/sources. list.d/ charm.list sudo apt upgrade && & & sudo apt set up sequin Fedora/RHEL echo'[charm]
name=Charm baseurl=https://repo.charm.sh/yum/ made it possible for=1 gpgcheck=1 gpgkey=https://repo.charm.sh/yum/gpg.key’|sudo tee/ etc/yum. repos.d/ charm.repo sudo yum set up sequin
Or, download it:
- Plans are readily available in Debian and RPM formats
- Binaries are readily available for Linux, macOS, Windows, FreeBSD, OpenBSD, and NetBSD
Or, simply install it with go:
go set up github.com/charmbracelet/sequin@latest Shell Completions
All the bundles and archives featured pre-generated conclusion declare Bash, ZSH, Fish, and PowerShell.
If you constructed it from source, you can create them with:
sequin conclusion celebration -h sequin conclusion zsh -h sequin conclusion fish -h sequin conclusion powershell -h
If you utilize a bundle (like Homebrew, Debs, and so on), the conclusions must be established instantly, offered your shell is set up appropriately.
Examples
Explaining escape series
Simply utilize printf to send out some series to sequin for a description.
printf ” x1b[38;5;4mCiaox1b[1;7mBaby.x1b[0mn”|sequin
Checking out the output of a program
You can likewise utilize it to examine the output of any program, for example, ls or git.
ls -1– color=constantly|sequin
git -c status.color=constantly status -sb|sequin
Yeah, it’s fantastic for debugging applications, and of course, finding out about ANSI!
Keep in mind
Numerous programs render their output as plain text when output isn’t a terminal (i.e. when rerouting to a file or piping to a program, like sequin). This is a good idea, other than in this case when we really desire ANSI series so we can check them. Luckily there are generally methods to require colors, like by setting CLICOLOR_FORCE=1 or with flags to require ANSI output. If you’re not seeing series make sure to examine what operate in the case of your particular program.
Taking a look at golden files
Golden apply for TUIs consist of ANSI, which can be quickly checked with sequin:
$ feline./ testdata/MyCuteApp. golden|sequin
To produce golden apply for your TUIs take a look at golden and teatest from the/ x task.