Skip to content

Commit ba98236

Browse files
committed
docs: document wait
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
1 parent 281a280 commit ba98236

File tree

1 file changed

+58
-38
lines changed

1 file changed

+58
-38
lines changed

README.md

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ vim demo.tape
3030
```
3131

3232
Tape files consist of a series of [commands](#vhs-command-reference). The commands are
33-
instructions for VHS to perform on its virtual terminal. For a list of all
33+
instructions for VHS to perform on its virtual terminal. For a list of all
3434
possible commands see [the command reference](#vhs-command-reference).
3535

3636
```elixir
@@ -101,8 +101,8 @@ docker run --rm -v $PWD:/vhs ghcr.io/charmbracelet/vhs <cassette>.tape
101101

102102
Or, download it:
103103

104-
* [Packages][releases] are available in Debian and RPM formats
105-
* [Binaries][releases] are available for Linux, macOS, and Windows
104+
- [Packages][releases] are available in Debian and RPM formats
105+
- [Binaries][releases] are available for Linux, macOS, and Windows
106106

107107
Or, just install it with `go`:
108108

@@ -113,18 +113,18 @@ go install github.com/charmbracelet/vhs@latest
113113
<details>
114114
<summary>Windows, Debian, Ubuntu, Fedora, RHEL, Void Instructions</summary>
115115

116-
* Debian / Ubuntu
116+
- Debian / Ubuntu
117117

118118
```sh
119119
# Debian/Ubuntu
120120
sudo mkdir -p /etc/apt/keyrings
121121
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
122122
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
123123
# Install ttyd from https://github.com/tsl0922/ttyd/releases
124-
sudo apt update && sudo apt install vhs ffmpeg
124+
sudo apt update && sudo apt install vhs ffmpeg
125125
```
126126

127-
* Fedora / RHEL
127+
- Fedora / RHEL
128128

129129
```sh
130130
echo '[charm]
@@ -137,13 +137,13 @@ gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
137137
sudo yum install vhs ffmpeg
138138
```
139139

140-
* Void
140+
- Void
141141

142142
```sh
143143
sudo xbps-install vhs
144144
```
145145

146-
* Windows
146+
- Windows
147147

148148
```sh
149149
winget install charmbracelet.vhs
@@ -178,7 +178,7 @@ vhs cassette.tape
178178
VHS allows you to publish your GIFs to our servers for easy sharing with your
179179
friends and colleagues. Specify which file you want to share, then use the
180180
`publish` sub-command to host it on `vhs.charm.sh`. The output will provide you
181-
with links to share your GIF via browser, HTML, and Markdown.
181+
with links to share your GIF via browser, HTML, and Markdown.
182182

183183
```bash
184184
vhs publish demo.gif
@@ -199,16 +199,15 @@ vhs serve
199199
<details>
200200
<summary>Configuration Options</summary>
201201

202-
* `VHS_PORT`: The port to listen on (`1976`)
203-
* `VHS_HOST`: The host to listen on (`localhost`)
204-
* `VHS_GID`: The Group ID to run the server as (current user's GID)
205-
* `VHS_UID`: The User ID to run the server as (current user's UID)
206-
* `VHS_KEY_PATH`: The path to the SSH key to use (`.ssh/vhs_ed25519`)
207-
* `VHS_AUTHORIZED_KEYS_PATH`: The path to the authorized keys file (empty, publicly accessible)
202+
- `VHS_PORT`: The port to listen on (`1976`)
203+
- `VHS_HOST`: The host to listen on (`localhost`)
204+
- `VHS_GID`: The Group ID to run the server as (current user's GID)
205+
- `VHS_UID`: The User ID to run the server as (current user's UID)
206+
- `VHS_KEY_PATH`: The path to the SSH key to use (`.ssh/vhs_ed25519`)
207+
- `VHS_AUTHORIZED_KEYS_PATH`: The path to the authorized keys file (empty, publicly accessible)
208208

209209
</details>
210210

211-
212211
Then, simply access VHS from a different machine via `ssh`:
213212

214213
```sh
@@ -222,20 +221,21 @@ ssh vhs.example.com < demo.tape > demo.gif
222221
223222
There are a few basic types of VHS commands:
224223

225-
* [`Output <path>`](#output): specify file output
226-
* [`Require <program>`](#require): specify required programs for tape file
227-
* [`Set <Setting> Value`](#settings): set recording settings
228-
* [`Type "<characters>"`](#type): emulate typing
229-
* [`Left`](#arrow-keys) [`Right`](#arrow-keys) [`Up`](#arrow-keys) [`Down`](#arrow-keys): arrow keys
230-
* [`Backspace`](#backspace) [`Enter`](#enter) [`Tab`](#tab) [`Space`](#space): special keys
231-
* [`Ctrl[+Alt][+Shift]+<char>`](#ctrl): press control + key and/or modifier
232-
* [`Sleep <time>`](#sleep): wait for a certain amount of time
233-
* [`Hide`](#hide): hide commands from output
234-
* [`Show`](#show): stop hiding commands from output
235-
* [`Screenshot`](#screenshot): screenshot the current frame
236-
* [`Copy/Paste`](#copy--paste): copy and paste text from clipboard.
237-
* [`Source`](#source): source commands from another tape
238-
* [`Env <Key> Value`](#env): set environment variables
224+
- [`Output <path>`](#output): specify file output
225+
- [`Require <program>`](#require): specify required programs for tape file
226+
- [`Set <Setting> Value`](#settings): set recording settings
227+
- [`Type "<characters>"`](#type): emulate typing
228+
- [`Left`](#arrow-keys) [`Right`](#arrow-keys) [`Up`](#arrow-keys) [`Down`](#arrow-keys): arrow keys
229+
- [`Backspace`](#backspace) [`Enter`](#enter) [`Tab`](#tab) [`Space`](#space): special keys
230+
- [`Ctrl[+Alt][+Shift]+<char>`](#ctrl): press control + key and/or modifier
231+
- [`Sleep <time>`](#sleep): wait for a certain amount of time
232+
- [`Wait[+Screen][+Line] /regex/`](#wait): wait for specific conditions
233+
- [`Hide`](#hide): hide commands from output
234+
- [`Show`](#show): stop hiding commands from output
235+
- [`Screenshot`](#screenshot): screenshot the current frame
236+
- [`Copy/Paste`](#copy--paste): copy and paste text from clipboard.
237+
- [`Source`](#source): source commands from another tape
238+
- [`Env <Key> Value`](#env): set environment variables
239239

240240
### Output
241241

@@ -345,6 +345,7 @@ Set the height of the terminal with the `Set Height` command.
345345
```elixir
346346
Set Height 1000
347347
```
348+
348349
<picture>
349350
<source media="(prefers-color-scheme: dark)" srcset="https://stuff.charm.sh/vhs/examples/height.gif">
350351
<source media="(prefers-color-scheme: light)" srcset="https://stuff.charm.sh/vhs/examples/height.gif">
@@ -432,14 +433,12 @@ command.
432433
Set Padding 0
433434
```
434435

435-
436436
<picture>
437437
<source media="(prefers-color-scheme: dark)" srcset="https://stuff.charm.sh/vhs/examples/padding.gif">
438438
<source media="(prefers-color-scheme: light)" srcset="https://stuff.charm.sh/vhs/examples/padding.gif">
439439
<img width="600" alt="Example of setting the padding" src="https://stuff.charm.sh/vhs/examples/padding.gif">
440440
</picture>
441441

442-
443442
#### Set Margin
444443

445444
Set the margin (in pixels) of the video with the `Set Margin` command.
@@ -486,7 +485,6 @@ Set BorderRadius 10
486485
<img width="400" alt="Example of setting the margin" src="https://vhs.charm.sh/vhs-4nYoy6IsUKmleJANG7N1BH.gif">
487486
</picture>
488487

489-
490488
#### Set Framerate
491489

492490
Set the rate at which VHS captures frames with the `Set Framerate` command.
@@ -669,6 +667,28 @@ PageUp 3
669667
PageDown 5
670668
```
671669

670+
### Wait
671+
672+
The `Wait` command allows you to wait for something to appear on the screen.
673+
This is useful when you need to wait on something to complete, even if you don't
674+
know how long it'll take, while including it in the recording like a spinner or
675+
loading state.
676+
The command takes a regular expression as an argument, and optionally allows to
677+
set the duration to wait and if you want to check the whole screen or just the
678+
last line (the scope).
679+
680+
```elixir
681+
Wait
682+
Wait /World/
683+
Wait+Screen /World/
684+
Wait+Line /World/
685+
Wait@10ms /World/
686+
Wait+Line@10ms /World/
687+
```
688+
689+
The default regular expression is `/>$/`, the wait timeout is `15s`, and the
690+
default scope is `Line`.
691+
672692
### Sleep
673693

674694
The `Sleep` command allows you to continue capturing frames without interacting
@@ -773,7 +793,7 @@ The `source` command allows you to execute commands from another tape.
773793
Source config.tape
774794
```
775795

776-
***
796+
---
777797

778798
## Continuous Integration
779799

@@ -803,15 +823,15 @@ It works great with Neovim, Emacs, and so on!
803823

804824
We’d love to hear your thoughts on this project. Feel free to drop us a note!
805825

806-
* [Twitter](https://twitter.com/charmcli)
807-
* [The Fediverse](https://mastodon.social/@charmcli)
808-
* [Discord](https://charm.sh/chat)
826+
- [Twitter](https://twitter.com/charmcli)
827+
- [The Fediverse](https://mastodon.social/@charmcli)
828+
- [Discord](https://charm.sh/chat)
809829

810830
## License
811831

812832
[MIT](https://github.com/charmbracelet/vhs/raw/main/LICENSE)
813833

814-
***
834+
---
815835

816836
Part of [Charm](https://charm.sh).
817837

0 commit comments

Comments
 (0)