bkahlert/recordr

Recordr is an automated terminal session recorder and SVG converter

https://github.com/bkahlert/recordr

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.7%) to scientific vocabulary

Keywords

bash conversion converter linux recorder recording session svg terminal
Last synced: 6 months ago · JSON representation

Repository

Recordr is an automated terminal session recorder and SVG converter

Basic Info
  • Host: GitHub
  • Owner: bkahlert
  • License: mit
  • Language: Shell
  • Default Branch: master
  • Homepage:
  • Size: 1 MB
Statistics
  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • Open Issues: 7
  • Releases: 4
Topics
bash conversion converter linux recorder recording session svg terminal
Created over 4 years ago · Last pushed over 3 years ago
Metadata Files
Readme Changelog Funding License Citation Codeowners

README.md

bkahlert/recordr Build Status Repository Size Repository Size

About

Recordr lets you record terminal sessions and convert them to SVG.

recorded terminal session demonstrating the recordr tool
Recordr Demo

recorded terminal session demonstrating the recordr tool recording the demo
Recordr recording the Recordr Demo

recorded terminal session demonstrating the logr logging library
Recordr recording the logr Demo

recorded terminal session demonstrating the images to ANSI converter
Recordr recording chafa converting Nyan Cat

Bash script

recordr is a Bash script.

In order to use it, it can either be downloaded and run like a binary or used as a Docker image.

To download recordr you can type:

shell sudo curl -LfsSo /usr/local/bin/recordr https://raw.githubusercontent.com/bkahlert/recordr/master/recordr chmod +x /usr/local/bin/recordr

Docker image

Build locally

```shell git clone https://github.com/bkahlert/recordr.git cd recordr

Build image and output to docker (default)

docker buildx bake

Build multi-platform image

docker buildx bake image-all ```

Image

Following platforms for this image are available:

  • linux/amd64
  • linux/arm64/v8

Usage

By default, recordr looks for a rec directory in the current working directory, converts all contained ● rec files concurrently to SVG animations and puts them in a docs directory.

The following options can be used to customize the conversion:

  • --rows — number of rows to use for recording and conversion (default: 25)
  • --indicator — name of the environmental variable set during recording (default: RECORDING)
  • --term — value to use for the TERM environmental variable (default: xterm-256color)
  • --out-dir — path to copy the created SVG files to (default: docs/)
  • --columns — number of columns to use for recording and conversion (default: 132)
  • --parallel — maximum number of conversions that run at once; 0 will run as many conversions as possible (default: 4)
  • --restart-delay — number of seconds until the animation restart (default: 5)
  • --build-dir — path to store (intermediate) build artifacts (default: build/rec/)
  • --term-profile — path to the terminal profile to use for conversion (default: auto)
  • --hide-recording — whether to hide the recording process (default: false)
  • --delete-build — whether to delete intermediary build files on completion (default: false)

Files: There are basically two ways to specify which ● rec files to convert:

  • Convert a single file: ./recordr rec/foo.rec
    same as: ./rec/foo.rec (interpreter form)
    same as: ./recordr --build-dir build/rec --out-dir docs rec/foo.rec (explicit directories)
    Before: text 📁work ⬅︎ you are here └─📁rec ├─🔴foo.rec └─📁bar └─🔴baz.rec After: text 📁work ⬅︎ you are here ├─📁rec │ ├─🔴foo.rec │ └─📁bar │ └─🔴baz.rec ├─📁build │ └─📁rec │ ├─📄foo.sh │ ├─📄foo.svg.0 │ ├─📄foo.svg.⋮ │ └─📄foo.svg.n └─📁docs └─🔴foo.svg ⬅︎ to SVG converted rec file

  • Convert a file tree: ./recordr rec
    same as: ./recordr (default directory: rec)
    same as: ./recordr --build-dir build/rec --out-dir docs rec (explicit default directories)
    same as: ./recordr rec foo.rec bar/baz.rec (explicit files)
    Before: text 📁work ⬅︎ you are here └─📁rec ├─🔴foo.rec └─📁bar └─🔴baz.rec After: text 📁work ⬅︎ you are here ├─📁rec │ ├─🔴foo.rec │ └─📁bar │ └─🔴baz.rec ├─📁build │ └─📁rec │ ├─📄foo.sh │ ├─📄foo.svg.0 │ ├─📄foo.svg.⋮ │ ├─📄foo.svg.n │ └─📁bar │ ├─📄baz.sh │ ├─📄baz.svg.0 │ ├─📄baz.svg.⋮ │ └─📄baz.svg.n └─📁docs ├─🔴foo.svg ⬅︎ to SVG converted rec file └─📁bar └─🔴baz.svg ⬅︎ to SVG converted rec file

To customize colors just export your settings from your favourite terminal emulator (see supported profiles) and put the profile in the directory containing your ● rec files.
The profile will be picked up automatically if you leave --term-profile to auto.

Bash script

shell recordr [OPTIONS] [DIR[/ ]FILE [FILE...]]

Docker image

shell docker run -it --rm \ -e TERM="$TERM" \ -v "$PWD":"$PWD" \ -w "$PWD" \ bkahlert/recordr [OPTIONS] [DIR[/ ]FILE [FILE...]]

Wrapper

The Recordr Wrapper recordrw needs nothing but a working Docker installation and either curl , wget, or wget2:

curl

shell curl -LfsS https://git.io/recordrw | "$SHELL" -s -- [OPTIONS] [DIR[/ ]FILE [FILE...]]

wget

shell wget -qO- https://git.io/recordrw | "$SHELL" -s -- [OPTIONS] [DIR[/ ]FILE [FILE...]]

wget2

shell wget2 -nv -O- https://git.io/recordrw | "$SHELL" -s -- [OPTIONS] [DIR[/ ]FILE [FILE...]]

GitHub Action

Recordr can also be used to automatically convert your terminal sessions to SVG files as part of your workflow.

The example below demonstrates how Recordr can be used to create a pull request containing all updated SVG files and their preview to show up right inside the pull request's description.

Usage Example

```yml jobs: docs: runs-on: ubuntu-latest

steps:
  - name: Prepare
    id: prep
    run: |
      echo ::set-output name=recordr-branch::"${{ github.ref_name }}--docs"

  - name: Checkout
    uses: actions/checkout@v2

  - name: ● REC terminal sessions
    if: github.event_name != 'pull_request'
    id: recordr
    uses: bkahlert/recordr@v0.2.2
    with:
      branch: ${{ steps.prep.outputs.recordr-branch }}

  - name: Create pull request
    uses: peter-evans/create-pull-request@v3
    if: startsWith(github.ref, 'refs/heads/')
    with:
      commit-message: |
        ${{ github.workflow }}(docs): update ${{ steps.recordr.outputs.file-list }}
      title: |
        ${{ github.workflow }}(docs): update ${{ steps.recordr.outputs.file-list }}
      body: |
        Updates ${{ steps.recordr.outputs.file-list }}
        ${{ steps.recordr.outputs.markdown }}
      labels: recordr,docs,rec
      branch: ${{ steps.prep.outputs.recordr-branch }}

```

All described options can be used to customize the conversion. Please consult action.yml for detailed information.

pull request created by GitHub action
Recordr GitHub Action

Image Configuration

This image can be configured using the following options of which all but APP_USER and APP_GROUP exist as both—build argument and environment variable.
You should go for build arguments if you want to set custom defaults you don't intend to change (often). Environment variables will overrule any existing configuration on each container start.

  • APP_USER Name of the main user (default: recordr)
  • APP_GROUP Name of the main user's group (default: recordr)
  • DEBUG Whether to log debug information (default: 0)
  • TZ Timezone the container runs in (default: UTC)
  • LANG Language/locale to use (default: C.UTF-8)
  • PUID User ID of the libguestfs user (default: 1000)
  • PGID Group ID of the libguestfs group (default: 1000)

```shell

Build single image with build argument TZ

docker buildx bake --build-arg TZ="$(date +"%Z")"

Build multi-platform image with build argument TZ

docker buildx bake image-all --build-arg TZ="$(date +"%Z")"

Start container with environment variable TZ

docker run --rm \ -e TZ="$(date +"%Z")" \ -v "$(pwd):$(pwd)" \ -w "$(pwd)" \ recordr:local ```

Authoring ● rec files

Before you can convert ● rec files to SVG you need to create them.
The following code snippet should suffice as a starting point:

```sh

!/usr/bin/env recordr

rec echo "Hello World!" ``` hello-world.rec

recorded terminal session printing "Hello World!"
Hello World! Example

To convert your file just execute it with recordr on your PATH: ```shell PATH=.:$PATH ./hello-world.rec

or

./recordr hello-world.rec ```

The environment variable TESTING will reduce animations to a minimum.
Set it to 1 for an even better efficiency.

recorded terminal session demonstrating the recordr tool recording the example
Recordr recording the Hello World! Example

```sh

!/usr/bin/env recordr

rec echo "Hello World!" ```

Testing

```shell git clone https://github.com/bkahlert/recordr.git cd recordr

Use Bats wrapper to run tests

curl -LfsS https://git.io/batsw \ | DOCKERBAKE="--set '*.tags=test'" "$SHELL" -s -- --batsw:-e --batsw:BUILDTAG=test test ```

Bats Wrapper is a self-contained wrapper to run tests based on the Bash testing framework Bats.

💡 To accelerate testing, the Bats Wrapper checks if any test is prefixed with a capital X and if so, only runs those tests.

Troubleshooting

  • You might experience problems when converting very long or complex terminal sessions.
    Try increasing the corresponding NODE_OPTIONS as you can see below.
  • To avoid permission problems with generated files, you can use your local user/group ID (see PUID/PGID).
  • If you need access to Docker, its command line interface is already installed.
    You can control your host instance by mounting /var/run/docker.sock.

shell docker run -it --rm \ -e PUID="$(id -u)" \ -e PGID="$(id -g)" \ -e NODE_OPTIONS="--max-old-space-size=16384" \ -e TERM="$TERM" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v "$PWD":"$PWD" \ -w "$PWD" \ bkahlert/recordr:edge

  • Authoring rec files benefits from short round-trips

Contributing

Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by making a Paypal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! :pray:

License

MIT. See LICENSE for more details.

TODO

  • [ ] add support for dim and italic

Owner

  • Name: Björn Kahlert
  • Login: bkahlert
  • Kind: user
  • Location: Berlin, Germany

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 29
  • Average time to close issues: N/A
  • Average time to close pull requests: 11 days
  • Total issue authors: 0
  • Total pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.14
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 28
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • github-actions[bot] (17)
  • dependabot[bot] (11)
  • bkahlert (1)
Top Labels
Issue Labels
Pull Request Labels
recordr (16) docs (16) rec (16) dependencies (11) github_actions (8) docker (3) recordr docs rec (2)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 4
github actions: bkahlert/recordr

Record terminal sessions and convert them to SVG

  • License: mit
  • Latest release: v0.2.2
    published about 4 years ago
  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Dependent packages count: 0.0%
Average: 20.7%
Stargazers count: 22.9%
Dependent repos count: 24.8%
Forks count: 35.2%
Last synced: 7 months ago

Dependencies

.github/workflows/build.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v2 composite
  • bkahlert/bats-wrapper v0.1.4 composite
  • docker/bake-action v1 composite
  • docker/login-action v1 composite
  • docker/metadata-action v3 composite
  • docker/setup-buildx-action v1 composite
  • docker/setup-qemu-action v1 composite
  • softprops/action-gh-release v1 composite
.github/workflows/docs.yml actions
  • ./ * composite
  • actions/checkout v2 composite
  • actions/upload-artifact v2 composite
  • peter-evans/create-pull-request v3 composite
.github/workflows/test-report.yml actions
  • dorny/test-reporter v1 composite
Dockerfile docker
  • docker 20.10.11-alpine3.14 build