2015-03-06 11:59:27 +01:00
|
|
|
# asciinema
|
2013-10-03 17:57:40 +02:00
|
|
|
|
2015-03-05 15:57:12 +01:00
|
|
|
[](https://travis-ci.org/asciinema/asciinema)
|
2013-10-03 17:57:40 +02:00
|
|
|
|
2015-03-06 11:59:27 +01:00
|
|
|
Terminal session recorder and the best companion of
|
|
|
|
|
[asciinema.org](https://asciinema.org).
|
2013-10-03 17:57:40 +02:00
|
|
|
|
2015-06-23 09:35:24 +02:00
|
|
|
[](https://asciinema.org/a/624fjx2rx7k3pctdozw7m8b24?autoplay=1)
|
2015-03-28 17:56:20 +01:00
|
|
|
|
2013-10-03 17:57:40 +02:00
|
|
|
## Installation
|
|
|
|
|
|
2014-12-17 16:23:15 +01:00
|
|
|
On Linux and Mac OS X, __the easiest way to install asciinema__ recorder is to
|
|
|
|
|
run the following shell command:
|
|
|
|
|
|
2014-12-17 17:12:22 +01:00
|
|
|
curl -sL https://asciinema.org/install | sh
|
2014-12-17 16:23:15 +01:00
|
|
|
|
|
|
|
|
[This script](https://asciinema.org/install) will download the latest asciinema
|
|
|
|
|
recorder binary for your platform, and install it in your `$PATH`.
|
|
|
|
|
|
2014-12-19 12:07:06 +01:00
|
|
|
Other installation options, including Homebrew and distro packages (Ubuntu,
|
|
|
|
|
Fedora, Arch Linux, Gentoo), are [also
|
2014-12-17 16:23:15 +01:00
|
|
|
available](https://asciinema.org/docs/installation).
|
|
|
|
|
|
2015-03-06 11:59:27 +01:00
|
|
|
If you have Go development environment set up you can `go get
|
|
|
|
|
github.com/asciinema/asciinema` to build asciinema and put the binary
|
|
|
|
|
in `$GOPATH/bin/asciinema`.
|
|
|
|
|
|
2014-12-17 16:23:15 +01:00
|
|
|
### Building from source
|
|
|
|
|
|
|
|
|
|
To build asciinema from source you need to have
|
|
|
|
|
[Go development environment](http://golang.org/doc/install) set up.
|
|
|
|
|
|
|
|
|
|
Following the steps below will get the source code and compile it into a single
|
|
|
|
|
statically linked binary:
|
|
|
|
|
|
|
|
|
|
mkdir -p $GOPATH/src/github.com/asciinema
|
2015-03-05 15:57:12 +01:00
|
|
|
git clone https://github.com/asciinema/asciinema.git $GOPATH/src/github.com/asciinema/asciinema
|
|
|
|
|
cd $GOPATH/src/github.com/asciinema/asciinema
|
2015-03-03 13:03:22 +01:00
|
|
|
make build
|
2014-12-17 16:23:15 +01:00
|
|
|
|
|
|
|
|
This will produce asciinema binary at `bin/asciinema`.
|
2013-10-03 17:57:40 +02:00
|
|
|
|
2014-12-18 12:05:44 +01:00
|
|
|
To install it system wide (to `/usr/local`):
|
|
|
|
|
|
|
|
|
|
sudo make install
|
|
|
|
|
|
|
|
|
|
If you want to install it in other location:
|
|
|
|
|
|
|
|
|
|
PREFIX=/the/prefix make install
|
|
|
|
|
|
2013-10-03 17:57:40 +02:00
|
|
|
## Usage
|
|
|
|
|
|
2015-03-06 11:59:27 +01:00
|
|
|
asciinema is composed of multiple commands, similar to `git`, `rails` or
|
2015-03-05 15:29:17 +01:00
|
|
|
`brew`.
|
2014-12-17 16:23:15 +01:00
|
|
|
|
2015-02-25 15:40:34 +01:00
|
|
|
When you run `asciinema` with no arguments help message is displayed showing
|
2015-03-05 15:29:17 +01:00
|
|
|
all available commands with their options.
|
2014-12-17 16:23:15 +01:00
|
|
|
|
2015-02-24 17:51:40 +01:00
|
|
|
### `rec [filename]`
|
2014-12-17 16:23:15 +01:00
|
|
|
|
2015-02-24 17:51:40 +01:00
|
|
|
__Record terminal session.__
|
2014-12-17 16:23:15 +01:00
|
|
|
|
|
|
|
|
This is the single most important command in asciinema, since it is how you
|
|
|
|
|
utilize this tool's main job.
|
|
|
|
|
|
2015-02-24 17:51:40 +01:00
|
|
|
By running `asciinema rec [filename]` you start a new recording session. The
|
|
|
|
|
command (process) that is recorded can be specified with `-c` option (see
|
|
|
|
|
below), and defaults to `$SHELL` which is what you want in most cases.
|
2014-12-17 16:23:15 +01:00
|
|
|
|
|
|
|
|
Recording finishes when you exit the shell (hit <kbd>Ctrl+D</kbd> or type
|
2015-02-24 17:51:40 +01:00
|
|
|
`exit`). If the recorded process is not a shell then recording finishes when
|
2014-12-17 16:23:15 +01:00
|
|
|
the process exits.
|
|
|
|
|
|
2015-02-24 17:51:40 +01:00
|
|
|
If the `filename` argument is given then the resulting recording (called
|
2015-02-25 15:26:38 +01:00
|
|
|
[asciicast](doc/asciicast-v1.md)) is saved to a local file. It can later be
|
|
|
|
|
replayed with `asciinema play <filename>` and/or uploaded to asciinema.org with
|
|
|
|
|
`asciinema upload <filename>`. If the `filename` argument is omitted then
|
|
|
|
|
(after asking for confirmation) the resulting asciicast is uploaded to
|
2015-03-12 15:27:58 +01:00
|
|
|
asciinema.org for further playback in a web browser.
|
2015-02-24 17:51:40 +01:00
|
|
|
|
2014-12-17 16:23:15 +01:00
|
|
|
`ASCIINEMA_REC=1` is added to recorded process environment variables. This
|
|
|
|
|
can be used by your shell's config file (`.bashrc`, `.zshrc`) to alter the
|
|
|
|
|
prompt or play a sound when shell is being recorded.
|
|
|
|
|
|
|
|
|
|
Available options:
|
|
|
|
|
|
2015-03-05 15:29:17 +01:00
|
|
|
* `-c, --command=<command>` - Specify command to record, defaults to $SHELL
|
|
|
|
|
* `-t, --title=<title>` - Specify title of the asciicast
|
|
|
|
|
* `-w, --max-wait=<sec>` - Reduce recorded terminal inactivity to max <sec> seconds
|
|
|
|
|
* `-y, --yes` - Answer yes to all prompts (e.g. upload confirmation)
|
2014-12-17 16:23:15 +01:00
|
|
|
|
2015-02-24 17:51:40 +01:00
|
|
|
### `play <filename>`
|
|
|
|
|
|
|
|
|
|
__Replay recorded asciicast in a terminal.__
|
|
|
|
|
|
|
|
|
|
This command replays given asciicast (as recorded by `rec` command) directly in
|
|
|
|
|
your terminal.
|
|
|
|
|
|
|
|
|
|
NOTE: it is recommended to run it in a terminal of dimensions not smaller than
|
|
|
|
|
the one used for recording as there's no "transcoding" of control sequences for
|
|
|
|
|
new terminal size.
|
|
|
|
|
|
2015-05-10 13:53:04 +02:00
|
|
|
Available options:
|
|
|
|
|
|
|
|
|
|
* `-w, --max-wait=<sec>` - Reduce replayed terminal inactivity to max <sec> seconds
|
|
|
|
|
|
2015-02-24 17:51:40 +01:00
|
|
|
### `upload <filename>`
|
|
|
|
|
|
|
|
|
|
__Upload recorded asciicast to asciinema.org site.__
|
|
|
|
|
|
|
|
|
|
This command uploads given asciicast (as recorded by `rec` command) to
|
2015-03-12 15:27:58 +01:00
|
|
|
asciinema.org for further playback in a web browser.
|
2015-02-24 17:51:40 +01:00
|
|
|
|
2015-02-25 16:24:15 +01:00
|
|
|
`asciinema rec demo.json` + `asciinema play demo.json` + `asciinema upload
|
|
|
|
|
demo.json` is a nice combo for when you want to review an asciicast before
|
|
|
|
|
publishing it on asciinema.org.
|
2015-02-24 17:51:40 +01:00
|
|
|
|
2014-12-17 16:23:15 +01:00
|
|
|
### `auth`
|
|
|
|
|
|
|
|
|
|
__Assign local API token to asciinema.org account.__
|
|
|
|
|
|
2015-03-12 15:27:58 +01:00
|
|
|
On every machine you install asciinema recorder, you get a new, unique API
|
|
|
|
|
token. This command connects this local token with your asciinema.org account,
|
|
|
|
|
and links all asciicasts recorded on this machine with the account.
|
2014-12-17 16:23:15 +01:00
|
|
|
|
2015-03-12 15:27:58 +01:00
|
|
|
This command displays the URL you should open in your web browser. If you never
|
|
|
|
|
logged in to asciinema.org then your account will be created when opening the
|
|
|
|
|
URL.
|
2014-12-17 16:23:15 +01:00
|
|
|
|
|
|
|
|
NOTE: it is __necessary__ to do this if you want to __edit or delete__ your
|
|
|
|
|
recordings on asciinema.org.
|
2013-10-03 17:57:40 +02:00
|
|
|
|
2015-05-24 12:29:58 +02:00
|
|
|
You can synchronize your config file (which keeps the API token) across the
|
|
|
|
|
machines but that's not necessary. You can assign new tokens to your account
|
|
|
|
|
from as many machines as you want.
|
2013-10-03 17:57:40 +02:00
|
|
|
|
2015-03-09 17:05:14 +01:00
|
|
|
## Configuration file
|
|
|
|
|
|
2015-05-24 12:29:58 +02:00
|
|
|
asciinema uses a config file to keep API token and user settings. In most cases
|
|
|
|
|
the location of this file is `$HOME/.config/asciinema/config`.
|
|
|
|
|
|
|
|
|
|
When you first run `asciinema`, local API token is generated and saved in the
|
2015-05-24 12:31:48 +02:00
|
|
|
file (unless the file already exists). It looks like this:
|
2015-03-09 17:05:14 +01:00
|
|
|
|
|
|
|
|
[api]
|
|
|
|
|
token = d5a2dce4-173f-45b2-a405-ac33d7b70c5f
|
|
|
|
|
|
2015-03-10 15:49:35 +01:00
|
|
|
There are several options you can set in this file. Here's a config with all
|
|
|
|
|
available options set:
|
2015-03-09 17:05:14 +01:00
|
|
|
|
|
|
|
|
[api]
|
|
|
|
|
token = d5a2dce4-173f-45b2-a405-ac33d7b70c5f
|
2015-03-10 15:49:35 +01:00
|
|
|
url = https://asciinema.example.com
|
2015-03-09 17:05:14 +01:00
|
|
|
|
|
|
|
|
[record]
|
|
|
|
|
command = /bin/bash -l
|
|
|
|
|
maxwait = 2
|
|
|
|
|
yes = true
|
|
|
|
|
|
2015-05-10 13:53:04 +02:00
|
|
|
[play]
|
|
|
|
|
maxwait = 1
|
|
|
|
|
|
2015-03-10 15:49:35 +01:00
|
|
|
The options in `[api]` section are related to API location and authentication.
|
|
|
|
|
To tell asciinema recorder to use your own asciinema site instance rather than
|
|
|
|
|
the default one (asciinema.org), you can set `url` option. API URL can also be
|
|
|
|
|
passed via `ASCIINEMA_API_URL` environment variable.
|
2015-03-09 17:05:14 +01:00
|
|
|
|
2015-05-10 13:53:04 +02:00
|
|
|
The options in `[record]` and `[play]` sections have the same meaning as the
|
|
|
|
|
options you pass to `asciinema rec`/`asciinema play` command. If you happen to
|
|
|
|
|
often use either `-c`, `-w` or `-y` with these commands then consider saving it
|
|
|
|
|
as a default in the config file.
|
2015-03-09 17:05:14 +01:00
|
|
|
|
2015-05-24 12:29:58 +02:00
|
|
|
### Configuration file locations
|
|
|
|
|
|
|
|
|
|
In fact, the following locations are checked for the presence of the config
|
|
|
|
|
file (in the given order):
|
|
|
|
|
|
|
|
|
|
* `$ASCIINEMA_CONFIG_HOME/config` - if you have set `$ASCIINEMA_CONFIG_HOME`
|
|
|
|
|
* `$XDG_CONFIG_HOME/asciinema/config` - on Linux, `$XDG_CONFIG_HOME` usually points to `$HOME/.config/`
|
|
|
|
|
* `$HOME/.config/asciinema/config` - in most cases it's here
|
|
|
|
|
* `$HOME/.asciinema/config` - created by asciinema versions prior to 1.1
|
|
|
|
|
|
|
|
|
|
The first one which is found is used.
|
|
|
|
|
|
2013-12-03 20:15:47 +01:00
|
|
|
## Contributing
|
|
|
|
|
|
|
|
|
|
If you want to contribute to this project check out
|
2014-02-09 14:05:55 +01:00
|
|
|
[Contributing](https://asciinema.org/contributing) page.
|
2013-12-03 20:15:47 +01:00
|
|
|
|
2013-10-06 12:58:29 +02:00
|
|
|
## Authors
|
2013-10-03 17:57:40 +02:00
|
|
|
|
2013-10-06 12:58:29 +02:00
|
|
|
Developed with passion by [Marcin Kulik](http://ku1ik.com) and great open
|
2015-03-05 15:57:12 +01:00
|
|
|
source [contributors](https://github.com/asciinema/asciinema/contributors)
|
2013-10-06 12:58:29 +02:00
|
|
|
|
2014-11-15 17:42:04 +01:00
|
|
|
## License
|
2013-10-06 12:58:29 +02:00
|
|
|
|
2015-02-24 17:51:40 +01:00
|
|
|
Copyright © 2011-2015 Marcin Kulik.
|
2014-11-15 17:42:04 +01:00
|
|
|
|
|
|
|
|
All code is licensed under the GPL, v3 or later. See LICENSE file for details.
|