Coder Social home page Coder Social logo

scastillo / asciinema Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asciinema/asciinema

0.0 2.0 0.0 1.67 MB

Terminal session recorder

Home Page: https://asciinema.org

License: GNU General Public License v3.0

Makefile 1.53% Python 91.30% Shell 7.17%

asciinema's Introduction

asciinema

Build Status license

Terminal session recorder and the best companion of asciinema.org.

demo

Installation

Native packages

asciinema is included in repositories of most popular package managers on Mac OS X, Linux and FreeBSD. Look for package named asciinema. See the list of available packages.

Python package

asciinema is available on PyPI and can be installed with pip (Python 3 required):

sudo pip3 install asciinema

Running latest version from master

If none of the above works for you (or you want to help with development) just clone the repo and run asciinema straight from the checkout:

git clone https://github.com/asciinema/asciinema.git
cd asciinema
python3 -m asciinema --version

Usage

asciinema is composed of multiple commands, similar to git, apt-get or brew.

When you run asciinema with no arguments help message is displayed, listing all available commands with their options.

rec [filename]

Record terminal session.

This is the single most important command in asciinema, since it is how you utilize this tool's main job.

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.

Recording finishes when you exit the shell (hit Ctrl+D or type exit). If the recorded process is not a shell then recording finishes when the process exits.

If the filename argument is given then the resulting recording (called asciicast) 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 asciinema.org for further playback in a web browser.

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:

  • -c, --command=<command> - Specify command to record, defaults to $SHELL
  • -t, --title=<title> - Specify the title of the asciicast
  • -w, --max-wait=<sec> - Reduce recorded terminal inactivity to max seconds
  • -y, --yes - Answer "yes" to all prompts (e.g. upload confirmation)
  • -q, --quiet - Be quiet, suppress all notices/warnings (implies -y)

play <filename>

Replay recorded asciicast in a terminal.

This command replays given asciicast (as recorded by rec command) directly in your terminal.

Playing from a local file:

asciinema play /path/to/asciicast.json

Playing from HTTP(S) URL:

asciinema play https://asciinema.org/a/22124.json
asciinema play http://example.com/demo.json

Playing from asciicast page URL (requires <link rel="alternate" type="application/asciicast+json" href="....json"> in page's HTML):

asciinema play https://asciinema.org/a/22124
asciinema play http://example.com/blog/post.html

Playing from stdin:

cat /path/to/asciicast.json | asciinema play -
ssh user@host cat asciicast.json | asciinema play -

Playing from IPFS:

asciinema play ipfs:/ipfs/QmcdXYJp6e4zNuimuGeWPwNMHQdxuqWmKx7NhZofQ1nw2V
asciinema play fs:/ipfs/QmcdXYJp6e4zNuimuGeWPwNMHQdxuqWmKx7NhZofQ1nw2V

Available options:

  • -w, --max-wait=<sec> - Reduce replayed terminal inactivity to max seconds

NOTE: it is recommended to run asciinema play 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.

upload <filename>

Upload recorded asciicast to asciinema.org site.

This command uploads given asciicast (as recorded by rec command) to asciinema.org for further playback in a web browser.

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.

auth

Manage recordings on asciinema.org account.

If you want to manage your recordings on asciinema.org (set title/description, delete etc) you need to authenticate. This command displays the URL you should open in your web browser to do that.

On every machine you run asciinema recorder, you get a new, unique API token. If you're already logged in on asciinema.org website and you run asciinema auth from a new computer then this new device will be linked to your account.

You can synchronize your config file (which keeps the API token) across the machines so all of them use the same token, but that's not necessary. You can assign new tokens to your account from as many machines as you want.

Configuration file

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.

NOTE: When you first run asciinema, local API token is generated (UUID) and saved in the file (unless the file already exists).

The auto-generated, minimal config file looks like this:

[api]
token = <your-api-token-here>

There are several options you can set in this file. Here's a config with all available options set:

[api]
token = <your-api-token-here>
url = https://asciinema.example.com

[record]
command = /bin/bash -l
maxwait = 2
yes = true
quiet = true

[play]
maxwait = 1

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.

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.

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 found is used.

Contributing

If you want to contribute to this project check out Contributing page.

Authors

Developed with passion by Marcin Kulik and great open source contributors

License

Copyright © 2011-2016 Marcin Kulik.

All code is licensed under the GPL, v3 or later. See LICENSE file for details.

asciinema's People

Contributors

alex avatar bentranter avatar caseyscarborough avatar gmjosack avatar hpurmann avatar jakubjedelsky avatar jellyfrog avatar krz8 avatar ku1ik avatar laughedelic avatar losingkeys avatar mhor avatar mneumann avatar sparrovv avatar swills avatar theatrus avatar zmwangx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.