pax_global_header00006660000000000000000000000064145154767720014534gustar00rootroot0000000000000052 comment=1a71be26c4c29e7cd98b97a11233cf3fb724ba9b .dockerignore000066400000000000000000000000201451547677200135440ustar00rootroot00000000000000dist/* **/*.pyc .github/000077500000000000000000000000001451547677200124405ustar00rootroot00000000000000.github/ISSUE_TEMPLATE/000077500000000000000000000000001451547677200146235ustar00rootroot00000000000000.github/ISSUE_TEMPLATE/bug-report.md000066400000000000000000000022111451547677200172270ustar00rootroot00000000000000--- name: Bug report about: Create a report to help improve asciinema title: '' labels: '' assignees: '' --- To make life of the project maintainers easier please submit bug reports only. This is bug tracker for asciinema cli (aka recorder). If your issue seems to be with another component (js player, server) then open an issue in related repository. If you're experiencing issue with asciinema server running at asciinema.org then contact admin@asciinema.org. Ideas, feature requests, help requests, questions and general discussions should be discussed in project's Discussions instead: https://github.com/orgs/asciinema/discussions If you think you've found a bug or regression, go ahead and delete this message and fill in the details below. ----- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. ... 2. ... 3. ... 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Versions:** - OS: [e.g. macOS 12.6, Ubuntu 23.04] - asciinema cli: [e.g. 2.2.0] **Additional context** Add any other context about the problem here. .github/dependabot.yml000066400000000000000000000001711451547677200152670ustar00rootroot00000000000000--- version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" .github/sponsor-logos/000077500000000000000000000000001451547677200152645ustar00rootroot00000000000000.github/sponsor-logos/dashcam/000077500000000000000000000000001451547677200166645ustar00rootroot00000000000000.github/sponsor-logos/dashcam/logo-on-dark.png000066400000000000000000001032301451547677200216620ustar00rootroot00000000000000PNG  IHDRWj=7 pHYs  ~ IDATx{}, X*iö>}N:rT,hSR WmͅPHi4 *IʭҔslsX%R"V&5ӧlĪUqARKZ<` a~@0 ge۶H@FH5p@R jT#A8 FH5p@R jT#A8 1>o%ɖ&%t[,ZkKc߲X$ev{!#xO:wΖ[]pyI' _[ʡ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Uvr8##>y3%i^ٶ踄moZm5k>.s߿vrxY0ƜDo_vj(@@76/)%Iè|EFYV *g624# [W$eN  0}jY' e5A8!8Зd~#'9IapCv"C=zv,')måaohؒFFF9I3jғ[@cldeOH&K=vz8+CkP񱼤UB"-p#%i^Fgk%TA8ڒف/,iaGƜrFJ.`lAxEFko^HG8:Ry/y6IxCh"];`<$ "pىjFRNLM|]Fk3y,p̉ +e8 GϝW2tNR(B6,kgh A8UHZ⵷,w8DA8|N(#)#)8i" µ)1pwW2JKJIJ˘ I)MK*ʨ,iٹJ76A8 F5p@b kX#A8 F5p@b kX#A8 {3.IENDB`.github/workflows/000077500000000000000000000000001451547677200144755ustar00rootroot00000000000000.github/workflows/asciinema.yml000066400000000000000000000055311451547677200171550ustar00rootroot00000000000000--- name: build on: - push - pull_request jobs: # Code style checks health: name: code health check runs-on: ubuntu-latest steps: - name: checkout asciinema uses: actions/checkout@v4 - name: setup Python uses: actions/setup-python@v4 with: python-version: "3.10" - name: install dependencies run: pip install build cmarkgfm pycodestyle twine - name: Run pycodestyle run: > find . -name '*\.py' -exec pycodestyle --ignore=E402,E501,E722,W503 "{}" \+ - name: Run twine run: | python3 -m build twine check dist/* # Asciinema checks asciinema: name: Asciinema runs-on: ubuntu-latest strategy: matrix: python: - "3.7" - "3.8" - "3.9" - "3.10" - "3.11" env: TERM: dumb steps: - name: checkout Asciinema uses: actions/checkout@v4 - name: setup Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - name: install dependencies run: pip install pytest - name: run Asciinema tests run: script -e -c make test build_distros: name: build distro images strategy: matrix: distros: - alpine - arch - debian - fedora - ubuntu runs-on: ubuntu-latest steps: - name: Set up Docker buildx id: buildx uses: docker/setup-buildx-action@v3 - name: Authenticate to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: "${{ github.actor }}" password: "${{ secrets.GITHUB_TOKEN }}" - name: "Build ${{ matrix.distros }} image" uses: docker/build-push-action@v5 with: file: "tests/distros/Dockerfile.${{ matrix.distros }}" tags: | "ghcr.io/${{ github.repository }}:${{ matrix.distros }}" push: true test_distros: name: integration test distro images needs: build_distros strategy: matrix: distros: - alpine - arch - debian - fedora - ubuntu runs-on: ubuntu-latest container: image: "ghcr.io/${{ github.repository }}:${{ matrix.distros }}" credentials: username: "${{ github.actor }}" password: "${{ secrets.GITHUB_TOKEN }}" # https://github.community/t/permission-problems-when-checking-out-code-as-part-of-github-action/202263 options: "--interactive --tty --user=1001:121" steps: - name: checkout Asciinema uses: actions/checkout@v4 - name: run integration tests env: TERM: dumb shell: 'script --return --quiet --command "bash {0}"' run: make test.integration .github/workflows/pre-commit.yml000066400000000000000000000004131451547677200172720ustar00rootroot00000000000000--- name: pre-commit on: - pull_request - push jobs: pre-commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.10" - uses: pre-commit/action@v3.0.0 .gitignore000066400000000000000000000025751451547677200131010ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # celery beat schedule file celerybeat-schedule # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # custom /dist tmp *.pyc *.tar.gz *.tar.bz2 *.tar.xz *.zip *.egg-info /build .pre-commit-config.yaml000066400000000000000000000016721451547677200153670ustar00rootroot00000000000000--- repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: check-ast - id: check-json - id: check-toml - id: check-yaml - id: end-of-file-fixer - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: - id: isort - repo: https://github.com/psf/black rev: 23.1.0 hooks: - id: black - repo: https://github.com/adrienverge/yamllint rev: v1.29.0 hooks: - id: yamllint - repo: https://github.com/myint/autoflake rev: v2.0.2 hooks: - id: autoflake args: - --in-place - --recursive - --expand-star-imports - --remove-all-unused-imports - --remove-duplicate-keys - --remove-unused-variables - repo: https://github.com/pre-commit/mirrors-mypy rev: "v1.1.1" hooks: - id: mypy CHANGELOG.md000066400000000000000000000230241451547677200127120ustar00rootroot00000000000000# asciinema changelog ## 2.4.0 (2023-10-23) * When recording without file arg we now ask whether to save, upload or discard the recording (#576) * Added capture of terminal resize events (#565) * Fixed blocking write error when PTY master is not ready (#569) (thanks @Low-power!) * Fixed "broken pipe" errors when piping certain commands during recording (#369) (thanks @Low-power!) * Fixed crash during playback of cast files with trailing blank line (#577) ## 2.3.0 (2023-07-05) * Added official support for Python 3.11 * Dropped official support for Python 3.6 * Implemented markers in `rec` and `play -m` commands * Added `--loop` option for looped playback in `play` command * Added `--stream` and `--out-fmt` option for customizing output of `play` command * Improved terminal charset detection (thanks @djds) * Extended `cat` command to support multiple files (thanks @Low-power) * Improved upload error messages * Fixed direct playback from URL * Made raw output start with terminal size sequence (`\e[8;H;Wt`) * Prevented recording to stdout when it's a TTY * Added target file permission checks to avoid ugly errors * Removed named pipe re-opening, which was causing hangs in certain scenarios * Improved PTY/TTY data reading - it goes in bigger chunks now (256 kb) * Fixed deadlock in PTY writes (thanks @Low-power) * Improved input forwarding from stdin * Ignored OSC responses in recorded stdin stream ## 2.2.0 (2022-05-07) * Added official support for Python 3.8, 3.9, 3.10 * Dropped official support for Python 3.5 * Added `--cols` / `--rows` options for overriding size of pseudo-terminal reported to recorded program * Improved behaviour of `--append` when output file doesn't exist * Keyboard input is now explicitly read from a TTY device in addition to stdin (when stdin != TTY) * Recorded program output is now explicitly written to a TTY device instead of stdout * Dash char (`-`) can now be passed as output filename to write asciicast to stdout * Diagnostic messages are now printed to stderr (without colors when stderr != TTY) * Improved robustness of writing asciicast to named pipes * Lots of codebase modernizations (many thanks to Davis @djds Schirmer!) * Many other internal refactorings ## 2.1.0 (2021-10-02) * Ability to pause/resume terminal capture with `C-\` key shortcut * Desktop notifications - only for the above pause feature at the moment * Removed dependency on tput/ncurses (thanks @arp242 / Martin Tournoij!) * ASCIINEMA_REC env var is back (thanks @landonb / Landon Bouma!) * Terminal answerbacks (CSI 6 n) in `asciinema cat` are now hidden (thanks @djpohly / Devin J. Pohly!) * Codeset detection works on HP-UX now (thanks @michael-o / Michael Osipov!) * Attempt at recording to existing file suggests use of `--overwrite` option now * Upload for users with very long `$USER` is fixed * Added official support for Python 3.8 and 3.9 * Dropped official support for EOL-ed Python 3.4 and 3.5 ## 2.0.2 (2019-01-12) * Official support for Python 3.7 * Recording is now possible on US-ASCII locale (thanks Jean-Philippe @jpouellet Ouellet!) * Improved Android support (thanks Fredrik @fornwall Fornwall!) * Possibility of programatic recording with `asciinema.record_asciicast` function * Uses new JSON response format added recently to asciinema-server * Tweaked message about how to stop recording (thanks Bachynin @vanyakosmos Ivan!) * Added proper description and other metadata to Python package (thanks @Crestwave!) ## 2.0.1 (2018-04-04) * Fixed example in asciicast v2 format doc (thanks Josh "@anowlcalledjosh" Holland!) * Replaced deprecated `encodestring` (since Python 3.1) with `encodebytes` (thanks @delirious-lettuce!) * Fixed location of config dir (you can `mv ~/.asciinema ~/.config/asciinema`) * Internal refactorings ## 2.0 (2018-02-10) This major release brings many new features, improvements and bugfixes. The most notable ones: * new [asciicast v2 file format](doc/asciicast-v2.md) * recording and playback of arbitrarily long session with minimal memory usage * ability to live-stream via UNIX pipe: `asciinema rec unix.pipe` + `asciinema play unix.pipe` in second terminal tab/window * optional stdin recording (`asciinema rec --stdin`) * appending to existing recording (`asciinema rec --append `) * raw recording mode, storing only stdout bytes (`asciinema rec --raw `) * environment variable white-listing (`asciinema rec --env="VAR1,VAR2..."`) * toggling pause in `asciinema play` by Space * stepping through a recording one frame at a time with . (when playback paused) * new `asciinema cat ` command to dump full output of the recording * playback from new IPFS URL scheme: `dweb:/ipfs/` (replaces `fs:/`) * lots of other bugfixes and improvements * dropped official support for Python 3.3 (although it still works on 3.3) ## 1.4.0 (2017-04-11) * Dropped distutils fallback in setup.py - setuptools required now (thanks Jakub "@jakubjedelsky" Jedelsky!) * Dropped official support for Python 3.2 (although it still works on 3.2) * New `--speed` option for `asciinema play` (thanks Bastiaan "@bastiaanb" Bakker!) * Ability to set API token via `ASCIINEMA_API_TOKEN` env variable (thanks Samantha "@samdmarshall" Marshall!) * Improved shutdown on more signals: CHLD, HUP, TERM, QUIT (thanks Richard "@typerlc"!) * Fixed stdin handling during playback via `asciinema play` ## 1.3.0 (2016-07-13) This release brings back the original Python implementation of asciinema. It's based on 0.9.8 codebase and adds all features and bug fixes that have been implemented in asciinema's Go version between 0.9.8 and 1.2.0. Other notable changes: * Zero dependencies! (other than Python 3) * Fixed crash when resizing terminal window during recording (#167) * Fixed upload from IPv6 hosts (#94) * Improved UTF-8 charset detection (#160) * `-q/--quiet` option can be saved in config file now * Final "logout" (produced by csh) is now removed from recorded stdout * `rec` command now tries to write to target path before starting recording ## 1.2.0 (2016-02-22) * Added playback from stdin: `cat demo.json | asciinema play -` * Added playback from IPFS: `asciinema play ipfs:/ipfs/QmcdXYJp6e4zNuimuGeWPwNMHQdxuqWmKx7NhZofQ1nw2V` * Added playback from asciicast page URL: `asciinema play https://asciinema.org/a/22124` * `-q/--quiet` option added to `rec` command * Fixed handling of partial UTF-8 sequences in recorded stdout * Final "exit" is now removed from recorded stdout * Longer operations like uploading/downloading show "spinner" ## 1.1.1 (2015-06-21) * Fixed putting terminal in raw mode (fixes ctrl-o in nano) ## 1.1.0 (2015-05-25) * `--max-wait` option is now also available for `play` command * Added support for compilation on FreeBSD * Improved locale/charset detection * Improved upload error messages * New config file location (with backwards compatibility) ## 1.0.0 (2015-03-12) * `--max-wait` and `--yes` options can be saved in config file * Support for displaying warning messages returned from API * Also, see changes for 1.0.0 release candidates below ## 1.0.0.rc2 (2015-03-08) * All dependencies are vendored now in Godeps dir * Help message includes all commands with their possible options * `-y` and `-t` options have longer alternatives: `--yes`, `--title` * `--max-wait` option has shorter alternative: `-w` * Import paths changed to `github.com/asciinema/asciinema` due to repository renaming * `-y` also suppresess "please resize terminal" prompt ## 1.0.0.rc1 (2015-03-02) * New [asciicast file format](doc/asciicast-v1.md) * `rec` command can now record to file * New commands: `play ` and `upload ` * UTF-8 native locale is now required * Added handling of status 413 and 422 by printing user friendly message ## 0.9.9 (2014-12-17) * Rewritten in Go * License changed to GPLv3 * `--max-wait` option added to `rec` command * Recorded process has `ASCIINEMA_REC` env variable set (useful for "rec" indicator in shell's `$PROMPT/$RPROMPT`) * No more terminal resetting (via `reset` command) before and after recording * Informative messages are coloured to be distinguishable from normal output * Improved error messages ## 0.9.8 (2014-02-09) * Rename user_token to api_token * Improvements to test suite * Send User-Agent including client version number, python version and platform * Handle 503 status as server maintenance * Handle 404 response as a request for client upgrade ## 0.9.7 (2013-10-07) * Depend on requests==1.1.0, not 2.0 ## 0.9.6 (2013-10-06) * Remove install script * Introduce proper python package: https://pypi.python.org/pypi/asciinema * Make the code compatible with both python 2 and 3 * Use requests lib instead of urrlib(2) ## 0.9.5 (2013-10-04) * Fixed measurement of total recording time * Improvements to install script * Introduction of Homebrew formula ## 0.9.4 (2013-10-03) * Use python2.7 in shebang ## 0.9.3 (2013-10-03) * Re-enable resetting of a terminal before and after recording * Add Arch Linux source package ## 0.9.2 (2013-10-02) * Use os.uname over running the uname command * Add basic integration tests * Make PtyRecorder test stable again * Move install script out of bin dir ## 0.9.1 (2013-10-01) * Split monolithic script into separate classes/files * Remove upload queue * Use python2 in generated binary's shebang * Delay config file creation until user_token is requested * Introduce command classes for handling cli commands * Split the recorder into classes with well defined responsibilities * Drop curl dependency, use urllib(2) for http requests ## 0.9.0 (2013-09-24) * Project rename from "ascii.io" to "asciinema" ## ... limbo? ... ## 0.1 (2012-03-11) * Initial release CODE_OF_CONDUCT.md000066400000000000000000000062331451547677200137030ustar00rootroot00000000000000# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at admin@asciinema.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ CONTRIBUTING.md000066400000000000000000000074211451547677200133350ustar00rootroot00000000000000# Contributing to asciinema First, if you're opening a GitHub issue make sure it goes to the correct repository: - [asciinema/asciinema](https://github.com/asciinema/asciinema/issues) - command-line recorder - [asciinema/asciinema-server](https://github.com/asciinema/asciinema-server/issues) - public website hosting recordings - [asciinema/asciinema-player](https://github.com/asciinema/asciinema-player/issues) - player ## Reporting bugs Open an issue in GitHub issue tracker. Tell us what's the problem and include steps to reproduce it (reliably). Including your OS/browser/terminal name and version in the report would be great. ## Submitting patches with bug fixes If you found a bug and made a patch for it: 1. Make sure your changes pass the [pre-commit](https://pre-commit.com/) [hooks](.pre-commit-config.yaml). You can install the hooks in your work tree by running `pre-commit install` in your checked out copy. 1. Make sure all tests pass. If you add new functionality, add new tests. 1. Send us a pull request, including a description of the fix (referencing an existing issue if there's one). ## Requesting new features We welcome all ideas. If you believe most asciinema users would benefit from implementing your idea then feel free to open a GitHub issue. However, as this is an open-source project maintained by a small team of volunteers we simply can't implement all of them due to limited resources. Please keep that in mind. ## Proposing features/changes (pull requests) If you want to propose code change, either introducing a new feature or improving an existing one, please first discuss this with asciinema team. You can simply open a separate issue for a discussion or join #asciinema IRC channel on Libera.Chat. ## Reporting security issues If you found a security issue in asciinema please contact us at admin@asciinema.org. For the benefit of all asciinema users please **do not** publish details of the vulnerability in a GitHub issue. The PGP key below (1eb33a8760dec34b) can be used when sending encrypted email to or verifying responses from admin@asciinema.org. ```Public Key -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG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7lYYIUAwUoFTrBeBd+d sN7htw3j7le99EiccqMXceZd2W9cAlRfXcjHtvbtkbJTcsvANSUSU10q5uuT3f6l NftTLWOGZnu/rFU/ow5ipKft0ygfJKpMHD+AoLkiRIajABEBAAGJAR8EGAECAAkF AlRH/yQCGwwACgkQHrM6h2Dew0tG1wgAqOkkSznwF+6muK88GgrgasqnIq2t2VkN fTEKmykgSuMxiN4bsNLc4FQECZqIcL7zGuD6fFnsnO6Hg36R4rYGFSEsjjN7rXj0 QLnrJJLZV0oA6Q77fUqdB0he7uJm+nlQjUv8HNJwp1oIyhhHz/r1kTHUlX+bEMO3 Khc96UnE7nzwPBCbUvKuHJQY6K2ms1wgr9ELXjF1KVU9QtBtG2/XWRGDHDwQKxnW +2pRVtn2xNJ9rBipGG86ZU88vurYjgPZrXaex3M1QGD/8+9Wlp/TR7YUzjiZbtwc 6mpG4SUlwZheX9RbTRdjnLr7Qy+CddOWvGxebgk23/U90KrDyHDHig== =2M/2 -----END PGP PUBLIC KEY BLOCK----- ``` Dockerfile000066400000000000000000000013571451547677200131000ustar00rootroot00000000000000# syntax=docker/dockerfile:1.3 FROM docker.io/library/ubuntu:22.04 ENV DEBIAN_FRONTEND="noninteractive" RUN apt-get update \ && apt-get install -y \ ca-certificates \ locales \ python3 \ python3-pip \ && localedef \ -i en_US \ -c \ -f UTF-8 \ -A /usr/share/locale/locale.alias \ en_US.UTF-8 COPY pyproject.toml setup.cfg *.md /usr/src/app/ COPY doc/*.md /usr/src/app/doc/ COPY man/asciinema.1 /usr/src/app/man/ COPY asciinema/ /usr/src/app/asciinema/ COPY README.md LICENSE /usr/src/app/ WORKDIR /usr/src/app RUN pip3 install . WORKDIR /root ENV LANG="en_US.utf8" ENV SHELL="/bin/bash" ENTRYPOINT ["/usr/local/bin/asciinema"] CMD ["--help"] # vim:ft=dockerfile LICENSE000066400000000000000000001045131451547677200121110ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . Makefile000066400000000000000000000025501451547677200125420ustar00rootroot00000000000000NAME := asciinema VERSION := $(shell python3 -c "import asciinema; print(asciinema.__version__)") VIRTUAL_ENV ?= .venv .PHONY: test test: test.unit test.integration .PHONY: test.unit test.unit: pytest .PHONY: test.integration test.integration: tests/integration.sh .PHONY: test.distros test.distros: tests/distros.sh .PHONY: release release: test tag push .PHONY: release.test release.test: test push.test .PHONY: .tag.exists .tag.exists: @git tag \ | grep -q "v$(VERSION)" \ && echo "Tag v$(VERSION) exists" \ && exit 1 .PHONY: tag tag: .tag.exists git tag -s -m "Releasing $(VERSION)" v$(VERSION) git push origin v$(VERSION) .PHONY: .venv .venv: python3 -m venv $(VIRTUAL_ENV) .PHONY: .pip .pip: .venv . $(VIRTUAL_ENV)/bin/activate \ && python3 -m pip install --upgrade build twine build: .pip . $(VIRTUAL_ENV)/bin/activate \ && python3 -m build . install: build . $(VIRTUAL_ENV)/bin/activate \ && python3 -m pip install . .PHONY: push push: .pip build . $(VIRTUAL_ENV)/bin/activate \ && python3 -m twine upload dist/* .PHONY: push.test push.test: .pip build . $(VIRTUAL_ENV)/bin/activate \ && python3 -m twine upload --repository testpypi dist/* .PHONY: clean clean: rm -rf dist *.egg-info clean.all: clean find . \ -type d \ -name __pycache__ \ -o -name .pytest_cache \ -o -name .mypy_cache \ -exec rm -r "{}" + README.md000066400000000000000000000435351451547677200123710ustar00rootroot00000000000000# asciinema [![Build Status](https://github.com/asciinema/asciinema/actions/workflows/asciinema.yml/badge.svg)](https://github.com/asciinema/asciinema/actions/workflows/asciinema.yml) [![PyPI](https://img.shields.io/pypi/v/asciinema.svg)](https://pypi.org/project/asciinema/) [![license](http://img.shields.io/badge/license-GNU-blue.svg)](https://raw.githubusercontent.com/asciinema/asciinema/master/LICENSE) Terminal session recorder and the best companion of [asciinema.org](https://asciinema.org). [![demo](https://asciinema.org/a/335480.svg)](https://asciinema.org/a/335480?autoplay=1) asciinema _[as-kee-nuh-muh]_ is a free and open source solution for recording terminal sessions and sharing them on the web. Shout-out to our Platinum [sponsors](https://github.com/sponsors/ku1ik), whose financial support helps keep the project alive: [](https://dashcam.io?utm_source=asciinemagithub) ## Quick intro asciinema lets you easily record terminal sessions and replay them in a terminal as well as in a web browser. Install latest version ([other installation options](#installation)) using [pipx](https://pypa.github.io/pipx/) (if you have it): ```sh pipx install asciinema ``` If you don't have pipx, install using pip with your preferred Python version: ```sh python3 -m pip install asciinema ``` Record your first session: ```sh asciinema rec first.cast ``` Now replay it with double speed: ```sh asciinema play -s 2 first.cast ``` Or with normal speed but with idle time limited to 2 seconds: ```sh asciinema play -i 2 first.cast ``` You can pass `-i 2` to `asciinema rec` as well, to set it permanently on a recording. Idle time limiting makes the recordings much more interesting to watch. Try it. If you want to watch and share it on the web, upload it: ```sh asciinema upload first.cast ``` The above uploads it to [asciinema.org](https://asciinema.org), which is a default [asciinema-server](https://github.com/asciinema/asciinema-server) instance, and prints a secret link you can use to watch your recording in a web browser. You can record and upload in one step by omitting the filename: ```sh asciinema rec ``` You'll be asked to confirm the upload when the recording is done. Nothing is sent anywhere without your consent. These are the basics, but there's much more you can do. The following sections cover installation, usage and hosting of the recordings in more detail. Also, checkout [agg](https://github.com/asciinema/agg) if you're interested in GIF generation. ## Installation ### Python package from PyPI [pypi]: https://pypi.python.org/pypi/asciinema asciinema is available on [PyPI] and can be installed with [pipx](https://pypa.github.io/pipx/) (if you have it) or with pip (Python 3 with setuptools required): ```sh pipx install asciinema ``` Or with pip (using your preferred Python version): ```sh python3 -m pip install asciinema ``` Installing from [PyPI] is the recommended way of installation, which gives you the latest released version. ### 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](https://asciinema.org/docs/installation). ### Running latest version from source code checkout If you can't use Python package or native package for your OS is outdated you can clone the repo and run asciinema straight from the checkout. Clone the repo: ```sh git clone https://github.com/asciinema/asciinema.git cd asciinema ``` If you want latest stable version: ```sh git checkout master ``` If you want current development version: ```sh git checkout develop ``` Then run it with: ```sh python3 -m asciinema --version ``` ### Docker image asciinema Docker image is based on [Ubuntu 22.04](https://releases.ubuntu.com/22.04/) and has the latest version of asciinema recorder pre-installed. ```sh docker pull ghcr.io/asciinema/asciinema ``` When running it don't forget to allocate a pseudo-TTY (`-t`), keep STDIN open (`-i`) and mount config directory volume (`-v`): ```sh docker run --rm -it -v "${HOME}/.config/asciinema:/root/.config/asciinema" ghcr.io/asciinema/asciinema rec ``` Container's entrypoint is set to `/usr/local/bin/asciinema` so you can run the container with any arguments you would normally pass to `asciinema` binary (see Usage section for commands and options). There's not much software installed in this image though. In most cases you may want to install extra programs before recording. One option is to derive new image from this one (start your custom Dockerfile with `FROM ghcr.io/asciinema/asciinema`). Another option is to start the container with `/bin/bash` as the entrypoint, install extra packages and manually start `asciinema rec`: ```console docker run --rm -it -v "${HOME}/.config/asciinema:/root/.config/asciinema" --entrypoint=/bin/bash ghcr.io/asciinema/asciinema rec root@6689517d99a1:~# apt-get install foobar root@6689517d99a1:~# asciinema rec ``` It is also possible to run the docker container as a non-root user, which has security benefits. You can specify a user and group id at runtime to give the application permission similar to the calling user on your host. ```sh docker run --rm -it \ --env=ASCIINEMA_CONFIG_HOME="/run/user/$(id -u)/.config/asciinema" \ --user="$(id -u):$(id -g)" \ --volume="${HOME}/.config/asciinema:/run/user/$(id -u)/.config/asciinema:rw" \ --volume="${PWD}:/data:rw" \ --workdir='/data' \ ghcr.io/asciinema/asciinema rec ``` ## 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.** 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. You can temporarily pause the capture of your terminal by pressing Ctrl+\\. This is useful when you want to execute some commands during the recording session that should not be captured (e.g. pasting secrets). Resume by pressing Ctrl+\\ again. When pausing desktop notification is displayed so you're sure the sensitive output won't be captured in the recording. 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 omitted then (after asking for confirmation) the resulting asciicast is uploaded to [asciinema-server](https://github.com/asciinema/asciinema-server) (by default to asciinema.org), where it can be watched and shared. If the `filename` argument is given then the resulting recording (called [asciicast](doc/asciicast-v2.md)) is saved to a local file. It can later be replayed with `asciinema play ` and/or uploaded to asciinema server with `asciinema upload `. `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 the shell is being recorded. Available options: - `--stdin` - Enable stdin (keyboard) recording (see below) - `--append` - Append to existing recording - `--raw` - Save raw STDOUT output, without timing information or other metadata - `--overwrite` - Overwrite the recording if it already exists - `-c, --command=` - Specify command to record, defaults to $SHELL - `-e, --env=` - List of environment variables to capture, defaults to `SHELL,TERM` - `-t, --title=` - Specify the title of the asciicast - `-i, --idle-time-limit=<sec>` - Limit recorded terminal inactivity to max `<sec>` seconds - `--cols=<n>` - Override terminal columns for recorded process - `--rows=<n>` - Override terminal rows for recorded process - `-y, --yes` - Answer "yes" to all prompts (e.g. upload confirmation) - `-q, --quiet` - Be quiet, suppress all notices/warnings (implies -y) Stdin recording allows for capturing of all characters typed in by the user in the currently recorded shell. This may be used by a player (e.g. [asciinema-player](https://github.com/asciinema/asciinema-player)) to display pressed keys. Because it's basically key-logging (scoped to a single shell instance), it's disabled by default, and has to be explicitly enabled via `--stdin` option. ### `play <filename>` **Replay recorded asciicast in a terminal.** This command replays given asciicast (as recorded by `rec` command) directly in your terminal. Following keyboard shortcuts are available by default: - <kbd>Space</kbd> - toggle pause, - <kbd>.</kbd> - step through a recording a frame at a time (when paused), - <kbd>Ctrl+C</kbd> - exit. See "Configuration file" section for information on how to customize the keyboard shortcuts. Playing from a local file: ```sh asciinema play /path/to/asciicast.cast ``` Playing from HTTP(S) URL: ```sh asciinema play https://asciinema.org/a/22124.cast asciinema play http://example.com/demo.cast ``` Playing from asciicast page URL (requires `<link rel="alternate" type="application/x-asciicast" href="/my/ascii.cast">` in page's HTML): ```sh asciinema play https://asciinema.org/a/22124 asciinema play http://example.com/blog/post.html ``` Playing from stdin: ```sh cat /path/to/asciicast.cast | asciinema play - ssh user@host cat asciicast.cast | asciinema play - ``` Playing from IPFS: ```sh asciinema play dweb:/ipfs/QmNe7FsYaHc9SaDEAEXbaagAzNw9cH7YbzN4xV7jV1MCzK/ascii.cast ``` Available options: - `-i, --idle-time-limit=<sec>` - Limit replayed terminal inactivity to max `<sec>` seconds - `-s, --speed=<factor>` - Playback speed (can be fractional) - `-l, --loop` - Play in a loop - `-m, --pause-on-markers` - Automatically pause on [markers](#markers) - `--stream=<stream>` - Select stream to play (see below) - `--out-fmt=<format>` - Select output format (see below) By default the output stream (`o`) is played. This is what you want in most cases. If you recorded the input stream (`i`) with `asciinema rec --stdin` then you can replay it with `asciinema play --stream=i <filename>`. By default the selected stream is written to stdout in original, raw data form. This is also what you want in majority of cases. However you can change the output format to asciicast (newline delimited JSON) with `asciinema play --out-fmt=asciicast <filename>`. This allows delegating actual rendering to another place (e.g. outside of your terminal) by piping output of `asciinema play` to a tool of your choice. > For the best playback experience 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. ### `cat <filename>` **Print full output of recorded asciicast to a terminal.** While `asciinema play <filename>` replays the recorded session using timing information saved in the asciicast, `asciinema cat <filename>` dumps the full output (including all escape sequences) to a terminal immediately. `asciinema cat existing.cast >output.txt` gives the same result as recording via `asciinema rec --raw output.txt`. ### `upload <filename>` **Upload recorded asciicast to asciinema.org site.** This command uploads given asciicast (recorded by `rec` command) to asciinema.org, where it can be watched and shared. `asciinema rec demo.cast` + `asciinema play demo.cast` + `asciinema upload demo.cast` is a nice combo if you want to review an asciicast before publishing it on asciinema.org. ### `auth` **Link your install ID with your asciinema.org user account.** If you want to manage your recordings (change title/theme, delete) at asciinema.org you need to link your "install ID" with asciinema.org user account. This command displays the URL to open in a web browser to do that. You may be asked to log in first. Install ID is a random ID ([UUID v4](https://en.wikipedia.org/wiki/Universally_unique_identifier)) generated locally when you run asciinema for the first time, and saved at `$HOME/.config/asciinema/install-id`. Its purpose is to connect local machine with uploaded recordings, so they can later be associated with asciinema.org account. This way we decouple uploading from account creation, allowing them to happen in any order. > A new install ID is generated on each machine and system user account you use > asciinema on, so in order to keep all recordings under a single asciinema.org > account you need to run `asciinema auth` on all of those machines. > asciinema versions prior to 2.0 confusingly referred to install ID as "API > token". ## Markers Markers allow marking specific time locations in a recording, which can be used for navigation, as well as for automatic pausing of the playback. Markers can be added to a recording in several ways: - while you are recording, by pressing a configured hotkey, see [add_marker_key config option](#configuration-file) - for existing recording, by inserting marker events (`"m"`) in the asciicast file, see [marker event](doc/asciicast-v2.md#m---marker) When replaying a recording with `asciinema play` you can enable auto-pause-on-marker behaviour with `-m`/`--pause-on-markers` option (it's off by default). When a marker is encountered, the playback automatically pauses and can be resumed by pressing space bar key. The playback continues until next marker is encountered. You can also fast-forward to the next marker by pressing `]` key (when paused). Markers can be useful in e.g. live demos: you can create a recording with markers, then play it back during presentation, and have it stop wherever you want to explain terminal contents in more detail. ## Hosting the recordings on the web As mentioned in the `Usage > rec` section above, if the `filename` argument to `asciinema rec` is omitted then the recorded asciicast is uploaded to [asciinema.org](https://asciinema.org). You can watch it there and share it via secret URL. If you prefer to host the recordings yourself, you can do so by either: - recording to a file (`asciinema rec demo.cast`), and using [asciinema's standalone web player](https://github.com/asciinema/asciinema-player#self-hosting-quick-start) in your HTML page, or - setting up your own [asciinema-server](https://github.com/asciinema/asciinema-server) instance, and [setting API URL accordingly](https://github.com/asciinema/asciinema-server/wiki/Installation-guide#using-asciinema-recorder-with-your-instance). ## Configuration file You can configure asciinema by creating config file at `$HOME/.config/asciinema/config`. Configuration is split into sections (`[api]`, `[record]`, `[play]`). Here's a list of all available options for each section: ```ini [api] ; API server URL, default: https://asciinema.org ; If you run your own instance of asciinema-server then set its address here ; It can also be overriden by setting ASCIINEMA_API_URL environment variable url = https://asciinema.example.com [record] ; Command to record, default: $SHELL command = /bin/bash -l ; Enable stdin (keyboard) recording, default: no stdin = yes ; List of environment variables to capture, default: SHELL,TERM env = SHELL,TERM,USER ; Limit recorded terminal inactivity to max n seconds, default: off idle_time_limit = 2 ; Answer "yes" to all interactive prompts, default: no yes = true ; Be quiet, suppress all notices/warnings, default: no quiet = true ; Define hotkey for pausing recording (suspending capture of output), ; default: C-\ (control + backslash) pause_key = C-p ; Define hotkey for adding a marker, default: none add_marker_key = C-x ; Define hotkey prefix key - when defined other recording hotkeys must ; be preceeded by it, default: no prefix prefix_key = C-a [play] ; Playback speed (can be fractional), default: 1 speed = 2 ; Limit replayed terminal inactivity to max n seconds, default: off idle_time_limit = 1 ; Define hotkey for pausing/resuming playback, ; default: space pause_key = p ; Define hotkey for stepping through playback, a frame at a time, ; default: . (dot) step_key = s ; Define hotkey for jumping to the next marker, ; default: ] next_marker_key = m [notifications] ; Desktop notifications are displayed on certain occasions, e.g. when ; pausing/resuming the capture of terminal with C-\ keyboard shortcut. ; Should desktop notifications be enabled, default: yes enabled = no ; Custom notification command ; asciinema automatically detects available desktop notification system ; (notify-send on GNU/Linux, osacript/terminal-notifier on macOS). Custom ; command can be used if needed. ; When invoked, environment variable $TEXT contains notification text, while ; $ICON_PATH contains path to the asciinema logo image. command = tmux display-message "$TEXT" ``` A very minimal config file could look like that: ```ini [record] idle_time_limit = 2 ``` Config directory location can be changed by setting `$ASCIINEMA_CONFIG_HOME` environment variable. If `$XDG_CONFIG_HOME` is set on Linux then asciinema uses `$XDG_CONFIG_HOME/asciinema` instead of `$HOME/.config/asciinema`. > asciinema versions prior to 1.1 used `$HOME/.asciinema`. If you have it > there you should `mv $HOME/.asciinema $HOME/.config/asciinema`. ## Sponsors asciinema is sponsored by: - [**Dashcam**](https://dashcam.io?utm_source=asciinemagithub) - [Brightbox](https://www.brightbox.com/) ## Consulting I offer consulting services for asciinema project. See https://asciinema.org/consulting for more information. ## Contributing If you want to contribute to this project check out [Contributing](https://asciinema.org/contributing) page. ## Authors Developed with passion by [Marcin Kulik](http://ku1ik.com) and great open source [contributors](https://github.com/asciinema/asciinema/contributors). ## License © 2011 Marcin Kulik. All code is licensed under the GPL, v3 or later. See [LICENSE](./LICENSE) file for details. �������������������������������������������������������������������������������������������������������������������������������������������������������������������Vagrantfile�����������������������������������������������������������������������������������������0000664�0000000�0000000�00000000732�14515476772�0013267�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "1024"] end config.vm.define "archlinux" do |c| c.vm.box = "terrywang/archlinux" end config.vm.define "ubuntu" do |c| c.vm.box = "ubuntu/trusty64" end end ��������������������������������������asciinema/������������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0013031�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/__init__.py�������������������������������������������������������������������������������0000664�0000000�0000000�00000001441�14515476772�0015142�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import sys __author__ = "Marcin Kulik" __version__ = "2.4.0" if sys.version_info < (3, 7): raise ImportError("Python < 3.7 is unsupported.") # pylint: disable=wrong-import-position from typing import Any, Optional from .recorder import record def record_asciicast( # pylint: disable=too-many-arguments path_: str, command: Any = None, append: bool = False, idle_time_limit: Optional[int] = None, record_stdin: bool = False, title: Optional[str] = None, command_env: Any = None, capture_env: Any = None, ) -> None: record( path_, command=command, append=append, idle_time_limit=idle_time_limit, record_stdin=record_stdin, title=title, command_env=command_env, capture_env=capture_env, ) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/__main__.py�������������������������������������������������������������������������������0000664�0000000�0000000�00000016573�14515476772�0015137�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import argparse import locale import os import sys from typing import Any, Optional from . import __version__, config from .commands.auth import AuthCommand from .commands.cat import CatCommand from .commands.play import PlayCommand from .commands.record import RecordCommand from .commands.upload import UploadCommand def valid_encoding() -> bool: def _locales() -> Optional[str]: try: return locale.nl_langinfo(locale.CODESET) except AttributeError: return locale.getlocale()[-1] loc = _locales() if loc is None: return False else: return loc.upper() in ("US-ASCII", "UTF-8", "UTF8") def positive_int(value: str) -> int: _value = int(value) if _value <= 0: raise argparse.ArgumentTypeError("must be positive") return _value def positive_float(value: str) -> float: _value = float(value) if _value <= 0.0: raise argparse.ArgumentTypeError("must be positive") return _value def maybe_str(v: Any) -> Optional[str]: if v is not None: return str(v) return None def main() -> Any: if not valid_encoding(): sys.stderr.write( "asciinema needs an ASCII or UTF-8 character encoding to run. " "Check the output of `locale` command.\n" ) return 1 try: cfg = config.load() except config.ConfigError as e: sys.stderr.write(f"{e}\n") return 1 # create the top-level parser parser = argparse.ArgumentParser( description="Record and share your terminal sessions, the right way.", epilog="""example usage: Record terminal and upload it to asciinema.org: \x1b[1masciinema rec\x1b[0m Record terminal to local file: \x1b[1masciinema rec demo.cast\x1b[0m Record terminal and upload it to asciinema.org, specifying title: \x1b[1masciinema rec -t "My git tutorial"\x1b[0m Record terminal to local file, limiting idle time to max 2.5 sec: \x1b[1masciinema rec -i 2.5 demo.cast\x1b[0m Replay terminal recording from local file: \x1b[1masciinema play demo.cast\x1b[0m Replay terminal recording hosted on asciinema.org: \x1b[1masciinema play https://asciinema.org/a/difqlgx86ym6emrmd8u62yqu8\x1b[0m Print full output of recorded session: \x1b[1masciinema cat demo.cast\x1b[0m For help on a specific command run: \x1b[1masciinema <command> -h\x1b[0m""", # noqa: E501 formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument( "--version", action="version", version=f"asciinema {__version__}" ) subparsers = parser.add_subparsers() # create the parser for the `rec` command parser_rec = subparsers.add_parser("rec", help="Record terminal session") parser_rec.add_argument( "--stdin", help="enable stdin recording, disabled by default", action="store_true", default=cfg.record_stdin, ) parser_rec.add_argument( "--append", help="append to existing recording", action="store_true", default=False, ) parser_rec.add_argument( "--raw", help="save only raw stdout output", action="store_true", default=False, ) parser_rec.add_argument( "--overwrite", help="overwrite the file if it already exists", action="store_true", default=False, ) parser_rec.add_argument( "-c", "--command", help="command to record, defaults to $SHELL", default=cfg.record_command, ) parser_rec.add_argument( "-e", "--env", help="list of environment variables to capture, defaults to " + config.DEFAULT_RECORD_ENV, default=cfg.record_env, ) parser_rec.add_argument("-t", "--title", help="title of the asciicast") parser_rec.add_argument( "-i", "--idle-time-limit", help="limit recorded idle time to given number of seconds", type=positive_float, default=maybe_str(cfg.record_idle_time_limit), ) parser_rec.add_argument( "--cols", help="override terminal columns for recorded process", type=positive_int, default=None, ) parser_rec.add_argument( "--rows", help="override terminal rows for recorded process", type=positive_int, default=None, ) parser_rec.add_argument( "-y", "--yes", help='answer "yes" to all prompts (e.g. upload confirmation)', action="store_true", default=cfg.record_yes, ) parser_rec.add_argument( "-q", "--quiet", help="be quiet, suppress all notices/warnings (implies -y)", action="store_true", default=cfg.record_quiet, ) parser_rec.add_argument( "filename", nargs="?", default="", help="filename/path to save the recording to", ) parser_rec.set_defaults(cmd=RecordCommand) # create the parser for the `play` command parser_play = subparsers.add_parser("play", help="Replay terminal session") parser_play.add_argument( "-i", "--idle-time-limit", help="limit idle time during playback to given number of seconds", type=positive_float, default=maybe_str(cfg.play_idle_time_limit), ) parser_play.add_argument( "-s", "--speed", help="set playback speed (can be fractional)", type=positive_float, default=cfg.play_speed, ) parser_play.add_argument( "-l", "--loop", help="loop loop loop loop", action="store_true", default=False, ) parser_play.add_argument( "-m", "--pause-on-markers", help="automatically pause on markers", action="store_true", default=False, ) parser_play.add_argument( "--out-fmt", help="select output format", choices=["raw", "asciicast"], default="raw", ) parser_play.add_argument( "--stream", help="select stream to play", choices=["o", "i"], default=None, ) parser_play.add_argument( "filename", help='local path, http/ipfs URL or "-" (read from stdin)' ) parser_play.set_defaults(cmd=PlayCommand) # create the parser for the `cat` command parser_cat = subparsers.add_parser( "cat", help="Print full output of terminal sessions" ) parser_cat.add_argument( "filename", nargs="+", help='local path, http/ipfs URL or "-" (read from stdin)', ) parser_cat.set_defaults(cmd=CatCommand) # create the parser for the `upload` command parser_upload = subparsers.add_parser( "upload", help="Upload locally saved terminal session to asciinema.org" ) parser_upload.add_argument( "filename", help="filename or path of local recording" ) parser_upload.set_defaults(cmd=UploadCommand) # create the parser for the `auth` command parser_auth = subparsers.add_parser( "auth", help="Manage recordings on asciinema.org account" ) parser_auth.set_defaults(cmd=AuthCommand) # parse the args and call whatever function was selected args = parser.parse_args() if hasattr(args, "cmd"): command = args.cmd(args, cfg, os.environ) code = command.execute() return code parser.print_help() return 1 if __name__ == "__main__": sys.exit(main()) �������������������������������������������������������������������������������������������������������������������������������������asciinema/api.py������������������������������������������������������������������������������������0000664�0000000�0000000�00000006277�14515476772�0014170�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import json import platform import re from typing import Any, Callable, Dict, Optional, Tuple, Union from urllib.parse import urlparse from . import __version__ from .http_adapter import HTTPConnectionError from .urllib_http_adapter import URLLibHttpAdapter class APIError(Exception): def __init__(self, e: str, retryable: bool): super().__init__(e) self.retryable = retryable class Api: def __init__( self, url: str, user: Optional[str], install_id: str, http_adapter: Any = None, ) -> None: self.url = url self.user = user self.install_id = install_id self.http_adapter = ( http_adapter if http_adapter is not None else URLLibHttpAdapter() ) def hostname(self) -> Optional[str]: return urlparse(self.url).hostname def auth_url(self) -> str: return f"{self.url}/connect/{self.install_id}" def upload_url(self) -> str: return f"{self.url}/api/asciicasts" def upload_asciicast(self, path_: str) -> Tuple[Any, Any]: with open(path_, "rb") as f: try: status, headers, body = self.http_adapter.post( self.upload_url(), files={"asciicast": ("ascii.cast", f)}, headers=self._headers(), username=self.user, password=self.install_id, ) except HTTPConnectionError as e: raise APIError(str(e), True) from e if status not in (200, 201): self._handle_error(status, body) if (headers.get("content-type") or "")[0:16] == "application/json": result = json.loads(body) else: result = {"url": body} return result, headers.get("Warning") def _headers(self) -> Dict[str, Union[Callable[[], str], str]]: return {"user-agent": self._user_agent(), "accept": "application/json"} @staticmethod def _user_agent() -> str: os = re.sub("([^-]+)-(.*)", "\\1/\\2", platform.platform()) return ( f"asciinema/{__version__} {platform.python_implementation()}" f"/{platform.python_version()} {os}" ) @staticmethod def _handle_error(status: int, body: bytes) -> None: errors = { 400: f"Invalid request: {body.decode('utf-8', 'replace')}", 401: "Invalid or revoked install ID", 404: ( "API endpoint not found. " "This asciinema version may no longer be supported. " "Please upgrade to the latest version." ), 413: "Sorry, the size of your recording exceeds the server-configured limit.", 422: f"Invalid asciicast: {body.decode('utf-8', 'replace')}", 503: "The server is down for maintenance.", } error = errors.get(status) if not error: if status >= 500: error = ( "The server is having temporary problems. " "Try again in a minute." ) else: error = f"HTTP status: {status}" raise APIError(error, status >= 500) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/asciicast/��������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0014774�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/asciicast/__init__.py���������������������������������������������������������������������0000664�0000000�0000000�00000010474�14515476772�0017113�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import codecs import gzip import os import sys import urllib.error from codecs import StreamReader from html.parser import HTMLParser from io import BytesIO from typing import Any, List, TextIO, Union from urllib.parse import urlparse, urlunparse from urllib.request import Request, urlopen from . import v1, v2 class LoadError(Exception): pass class Parser(HTMLParser): def __init__(self) -> None: HTMLParser.__init__(self) self.url = None def error(self, message: str) -> None: raise NotImplementedError( "subclasses of ParserBase must override error()" ", but HTMLParser does not" ) def handle_starttag(self, tag: str, attrs: List[Any]) -> None: # look for <link rel="alternate" # type="application/x-asciicast" # href="https://...cast"> if tag == "link": # avoid modifying function signature keyword args from base class _attrs = {} for k, v in attrs: _attrs[k] = v if _attrs.get("rel") == "alternate": type_ = _attrs.get("type") if type_ in ( "application/asciicast+json", "application/x-asciicast", ): self.url = _attrs.get("href") def open_url(url: str) -> Union[StreamReader, TextIO]: if url == "-": return sys.stdin if url.startswith("ipfs://"): url = f"https://ipfs.io/ipfs/{url[7:]}" elif url.startswith("dweb:/ipfs/"): url = f"https://ipfs.io/{url[5:]}" if url.startswith("http:") or url.startswith("https:"): req = Request(url) req.add_header("Accept-Encoding", "gzip") body = None content_type = None utf8_reader = codecs.getreader("utf-8") with urlopen(req) as response: body = response content_type = response.headers["Content-Type"] url = response.geturl() # final URL after redirects if response.headers["Content-Encoding"] == "gzip": body = gzip.open(body) body = BytesIO(body.read()) if content_type and content_type.startswith("text/html"): html = utf8_reader(body, errors="replace").read() parser = Parser() parser.feed(html) new_url = parser.url if not new_url: raise LoadError( '<link rel="alternate" ' 'type="application/x-asciicast" ' 'href="..."> ' "not found in fetched HTML document" ) if "://" not in new_url: base_url = urlparse(url) if new_url.startswith("/"): new_url = urlunparse( (base_url[0], base_url[1], new_url, "", "", "") ) else: path = f"{os.path.dirname(base_url[2])}/{new_url}" new_url = urlunparse( (base_url[0], base_url[1], path, "", "", "") ) return open_url(new_url) return utf8_reader(body, errors="strict") return open(url, mode="rt", encoding="utf-8") class open_from_url: FORMAT_ERROR = "only asciicast v1 and v2 formats can be opened" def __init__(self, url: str) -> None: self.url = url self.file: Union[StreamReader, TextIO, None] = None self.context: Any = None def __enter__(self) -> Any: try: self.file = open_url(self.url) first_line = self.file.readline() try: # try v2 first self.context = v2.open_from_file(first_line, self.file) return self.context.__enter__() except v2.LoadError: try: # try v1 next self.context = v1.open_from_file(first_line, self.file) return self.context.__enter__() except v1.LoadError as e: raise LoadError(self.FORMAT_ERROR) from e except (OSError, urllib.error.HTTPError) as e: raise LoadError(str(e)) from e def __exit__( self, exc_type: str, exc_value: str, exc_traceback: str ) -> None: self.context.__exit__(exc_type, exc_value, exc_traceback) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/asciicast/events.py�����������������������������������������������������������������������0000664�0000000�0000000�00000001722�14515476772�0016654�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������from typing import Any, Generator, Iterable, List, Optional def to_relative_time( events: Iterable[Any], ) -> Generator[List[Any], None, None]: prev_time = 0 for frame in events: time, type_, data = frame delay = time - prev_time prev_time = time yield [delay, type_, data] def to_absolute_time( events: Iterable[Any], ) -> Generator[List[Any], None, None]: time = 0 for frame in events: delay, type_, data = frame time = time + delay yield [time, type_, data] def cap_relative_time( events: Iterable[Any], time_limit: Optional[float] ) -> Iterable[Any]: if time_limit: return ( [min(delay, time_limit), type_, data] for delay, type_, data in events ) return events def adjust_speed( events: Iterable[Any], speed: Any ) -> Generator[List[Any], None, None]: return ([delay / speed, type_, data] for delay, type_, data in events) ����������������������������������������������asciinema/asciicast/raw.py��������������������������������������������������������������������������0000664�0000000�0000000�00000003467�14515476772�0016151�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import os import sys from os import path from typing import Any, Callable, Optional, Tuple from ..file_writer import file_writer class writer(file_writer): def __init__( # pylint: disable=too-many-arguments self, path_: str, metadata: Any = None, append: bool = False, buffering: int = 0, on_error: Optional[Callable[[str], None]] = None, ) -> None: super().__init__(path_, on_error) if ( append and path.exists(path_) and os.stat(path_).st_size == 0 ): # true for pipes append = False self.buffering = buffering if append: self.mode = "ab" self.header = None else: self.mode = "wb" width = metadata["width"] height = metadata["height"] self.header = f"\x1b[8;{height};{width}t".encode("utf-8") def __enter__(self) -> Any: super().__enter__() if self.header: self._write(self.header) return self def write_stdout(self, _ts: float, data: Any) -> None: self._write(data) def write_stdin(self, ts: float, data: Any) -> None: pass def write_marker(self, ts: float) -> None: pass def write_resize(self, ts: float, size: Tuple[int, int]) -> None: cols, rows = size self._write(f"\x1b[8;{rows};{cols}t".encode("utf-8")) # pylint: disable=consider-using-with def _open_file(self) -> None: if self.path == "-": self.file = os.fdopen( sys.stdout.fileno(), mode=self.mode, buffering=self.buffering, closefd=False, ) else: self.file = open( self.path, mode=self.mode, buffering=self.buffering ) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/asciicast/v1.py���������������������������������������������������������������������������0000664�0000000�0000000�00000003462�14515476772�0015701�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import json from codecs import StreamReader from json.decoder import JSONDecodeError from typing import ( Any, Dict, Generator, Iterable, List, Optional, TextIO, Union, ) from .events import to_absolute_time class LoadError(Exception): pass class Asciicast: def __init__(self, attrs: Dict[str, Any]) -> None: self.version: int = 1 self.__attrs = attrs self.idle_time_limit = None # v1 doesn't store it @property def v2_header(self) -> Dict[str, Any]: keys = ["width", "height", "duration", "command", "title", "env"] header = { k: v for k, v in self.__attrs.items() if k in keys and v is not None } return header def events(self, type_: Optional[str] = None) -> Iterable[List[Any]]: if type_ in [None, "o"]: return to_absolute_time(self.__stdout_events()) else: return [] def __stdout_events(self) -> Generator[List[Any], None, None]: for time, data in self.__attrs["stdout"]: yield [time, "o", data] class open_from_file: FORMAT_ERROR: str = "only asciicast v1 format can be opened" def __init__( self, first_line: str, file: Union[TextIO, StreamReader] ) -> None: self.first_line = first_line self.file = file def __enter__(self) -> Optional[Asciicast]: try: attrs = json.loads(self.first_line + self.file.read()) if attrs.get("version") == 1: return Asciicast(attrs) raise LoadError(self.FORMAT_ERROR) except JSONDecodeError as e: raise LoadError(self.FORMAT_ERROR) from e def __exit__( self, exc_type: str, exc_value: str, exc_traceback: str ) -> None: self.file.close() ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/asciicast/v2.py���������������������������������������������������������������������������0000664�0000000�0000000�00000012310�14515476772�0015672�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import codecs import json import os import sys from codecs import StreamReader from json.decoder import JSONDecodeError from typing import ( Any, Callable, Dict, Generator, List, Optional, TextIO, Tuple, Union, ) from ..file_writer import file_writer class LoadError(Exception): pass class Asciicast: def __init__( self, f: Union[TextIO, StreamReader], header: Dict[str, Any] ) -> None: self.version: int = 2 self.__file = f self.v2_header = header self.idle_time_limit = header.get("idle_time_limit") def events( self, type_: Optional[str] = None ) -> Generator[List[Any], None, None]: if type_ is None: for line in self.__file: if line == "\n": break yield json.loads(line) else: for line in self.__file: if line == "\n": break event = json.loads(line) if event[1] == type_: yield event def build_from_header_and_file( header: Dict[str, Any], f: Union[StreamReader, TextIO] ) -> Asciicast: return Asciicast(f, header) class open_from_file: FORMAT_ERROR = "only asciicast v2 format can be opened" def __init__( self, first_line: str, file: Union[StreamReader, TextIO] ) -> None: self.first_line = first_line self.file = file def __enter__(self) -> Asciicast: try: v2_header: Dict[str, Any] = json.loads(self.first_line) if v2_header.get("version") == 2: return build_from_header_and_file(v2_header, self.file) raise LoadError(self.FORMAT_ERROR) except JSONDecodeError as e: raise LoadError(self.FORMAT_ERROR) from e def __exit__( self, exc_type: str, exc_value: str, exc_traceback: str ) -> None: self.file.close() def get_duration(path_: str) -> Any: with open(path_, mode="rt", encoding="utf-8") as f: first_line = f.readline() with open_from_file(first_line, f) as a: last_frame = None for last_frame in a.events("o"): pass return last_frame[0] def build_header( width: Optional[int], height: Optional[int], metadata: Any ) -> Dict[str, Any]: header = {"version": 2, "width": width, "height": height} header.update(metadata) assert "width" in header, "width missing in metadata" assert "height" in header, "height missing in metadata" assert isinstance(header["width"], int) assert isinstance(header["height"], int) if "timestamp" in header: assert isinstance(header["timestamp"], (int, float)) return header class writer(file_writer): def __init__( # pylint: disable=too-many-arguments self, path_: str, metadata: Any = None, append: bool = False, buffering: int = 1, width: Optional[int] = None, height: Optional[int] = None, on_error: Optional[Callable[[str], None]] = None, ) -> None: super().__init__(path_, on_error) self.buffering = buffering self.stdin_decoder = codecs.getincrementaldecoder("UTF-8")("replace") self.stdout_decoder = codecs.getincrementaldecoder("UTF-8")("replace") if append: self.mode = "a" self.header = None else: self.mode = "w" self.header = build_header(width, height, metadata or {}) def __enter__(self) -> Any: self._open_file() if self.header: self.__write_line(self.header) return self def write_stdout(self, ts: float, data: Union[str, bytes]) -> None: if isinstance(data, str): data = data.encode(encoding="utf-8", errors="strict") data = self.stdout_decoder.decode(data) self.__write_event(ts, "o", data) def write_stdin(self, ts: float, data: Union[str, bytes]) -> None: if isinstance(data, str): data = data.encode(encoding="utf-8", errors="strict") data = self.stdin_decoder.decode(data) self.__write_event(ts, "i", data) def write_marker(self, ts: float) -> None: self.__write_event(ts, "m", "") def write_resize(self, ts: float, size: Tuple[int, int]) -> None: cols, rows = size self.__write_event(ts, "r", f"{cols}x{rows}") # pylint: disable=consider-using-with def _open_file(self) -> None: if self.path == "-": self.file = os.fdopen( sys.stdout.fileno(), mode=self.mode, buffering=self.buffering, encoding="utf-8", closefd=False, ) else: self.file = open( self.path, mode=self.mode, buffering=self.buffering, encoding="utf-8", ) def __write_event(self, ts: float, etype: str, data: str) -> None: self.__write_line([round(ts, 6), etype, data]) def __write_line(self, obj: Any) -> None: line = json.dumps( obj, ensure_ascii=False, indent=None, separators=(", ", ": ") ) self._write(f"{line}\n") ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/async_worker.py���������������������������������������������������������������������������0000664�0000000�0000000�00000003037�14515476772�0016114�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������from typing import Any, Optional try: # Importing synchronize is to detect platforms where # multiprocessing does not work (python issue 3770) # and cause an ImportError. Otherwise it will happen # later when trying to use Queue(). from multiprocessing import Process, Queue, synchronize # pylint: disable=pointless-statement lambda _=synchronize: None # avoid pruning import except ImportError: from queue import Queue # type: ignore from threading import Thread as Process # type: ignore class async_worker: def __init__(self) -> None: self.queue: Queue[Any] = Queue() self.process: Optional[Process] = None def __enter__(self) -> Any: self.process = Process(target=self._run) self.process.start() return self def _run(self) -> None: try: self.run() except KeyboardInterrupt: pass def __exit__( self, exc_type: str, exc_value: str, exc_traceback: str ) -> None: self.queue.put(None) assert isinstance(self.process, Process) self.process.join() if self.process.exitcode != 0: raise RuntimeError( f"worker process exited with code {self.process.exitcode}" ) def enqueue(self, payload: Any) -> None: self.queue.put(payload) def run(self) -> None: payload: Any for payload in iter(self.queue.get, None): # pylint: disable=no-member self.perform(payload) # type: ignore[attr-defined] �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/commands/���������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0014632�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/commands/__init__.py����������������������������������������������������������������������0000664�0000000�0000000�00000000000�14515476772�0016731�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/commands/auth.py��������������������������������������������������������������������������0000664�0000000�0000000�00000001345�14515476772�0016150�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������from typing import Any, Dict from ..config import Config from .command import Command class AuthCommand(Command): def __init__(self, args: Any, config: Config, env: Dict[str, str]) -> None: Command.__init__(self, args, config, env) def execute(self) -> None: self.print( f"Open the following URL in a web browser to link your install ID " f"with your {self.api.hostname()} user account:\n\n" f"{self.api.auth_url()}\n\n" "This will associate all recordings uploaded from this machine " "(past and future ones) to your account" ", and allow you to manage them (change title/theme, delete) at " f"{self.api.hostname()}." ) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/commands/cat.py���������������������������������������������������������������������������0000664�0000000�0000000�00000001766�14515476772�0015765�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import sys from typing import Any, Dict from .. import asciicast from ..config import Config from ..tty_ import raw from .command import Command class CatCommand(Command): def __init__(self, args: Any, config: Config, env: Dict[str, str]): Command.__init__(self, args, config, env) self.filenames = args.filename def execute(self) -> int: try: with open("/dev/tty", "rt", encoding="utf-8") as stdin: with raw(stdin.fileno()): return self.cat() except OSError: return self.cat() def cat(self) -> int: try: for filename in self.filenames: with asciicast.open_from_url(filename) as a: for _, _type, text in a.events("o"): sys.stdout.write(text) sys.stdout.flush() except asciicast.LoadError as e: self.print_error(f"printing failed: {str(e)}") return 1 return 0 ����������asciinema/commands/command.py�����������������������������������������������������������������������0000664�0000000�0000000�00000002055�14515476772�0016624�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import os import sys from typing import Any, Dict, Optional from ..api import Api from ..config import Config class Command: def __init__(self, _args: Any, config: Config, env: Dict[str, str]): self.quiet: bool = False self.api = Api(config.api_url, env.get("USER"), config.install_id) def print( self, text: str, end: str = "\r\n", color: Optional[int] = None, force: bool = False, flush: bool = False, ) -> None: if not self.quiet or force: if color is not None and os.isatty(sys.stderr.fileno()): text = f"\x1b[0;3{color}m{text}\x1b[0m" print(text, file=sys.stderr, end=end) if flush: sys.stderr.flush() def print_info(self, text: str) -> None: self.print(f"asciinema: {text}", color=2) def print_warning(self, text: str) -> None: self.print(f"asciinema: {text}", color=3) def print_error(self, text: str) -> None: self.print(f"asciinema: {text}", color=1, force=True) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/commands/play.py��������������������������������������������������������������������������0000664�0000000�0000000�00000003330�14515476772�0016150�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������from typing import Any, Dict, Optional from .. import asciicast from ..commands.command import Command from ..config import Config from ..player import Player class PlayCommand(Command): def __init__( self, args: Any, config: Config, env: Dict[str, str], player: Optional[Player] = None, ) -> None: Command.__init__(self, args, config, env) self.filename = args.filename self.idle_time_limit = args.idle_time_limit self.speed = args.speed self.loop = args.loop self.out_fmt = args.out_fmt self.stream = args.stream self.pause_on_markers = args.pause_on_markers self.player = player if player is not None else Player() self.key_bindings = { "pause": config.play_pause_key, "step": config.play_step_key, "next_marker": config.play_next_marker_key, } def execute(self) -> int: code = self.play() if self.loop: while code == 0: code = self.play() return code def play(self) -> int: try: with asciicast.open_from_url(self.filename) as a: self.player.play( a, idle_time_limit=self.idle_time_limit, speed=self.speed, key_bindings=self.key_bindings, out_fmt=self.out_fmt, stream=self.stream, pause_on_markers=self.pause_on_markers, ) except asciicast.LoadError as e: self.print_error(f"playback failed: {str(e)}") return 1 except KeyboardInterrupt: return 1 return 0 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/commands/record.py������������������������������������������������������������������������0000664�0000000�0000000�00000015553�14515476772�0016473�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import os import sys from tempfile import NamedTemporaryFile from typing import Any, Dict, Optional from .. import notifier, recorder from ..api import APIError from ..asciicast import raw, v2 from ..commands.command import Command from ..config import Config class RecordCommand(Command): # pylint: disable=too-many-instance-attributes def __init__(self, args: Any, config: Config, env: Dict[str, str]) -> None: Command.__init__(self, args, config, env) self.quiet = args.quiet self.filename = args.filename self.record_stdin = args.stdin self.command = args.command self.env_whitelist = args.env self.title = args.title self.assume_yes = args.yes or args.quiet self.idle_time_limit = args.idle_time_limit self.cols_override = args.cols self.rows_override = args.rows self.append = args.append self.overwrite = args.overwrite self.raw = args.raw self.writer = raw.writer if args.raw else v2.writer self.notifier = notifier.get_notifier( config.notifications_enabled, config.notifications_command ) self.env = env self.key_bindings = { "prefix": config.record_prefix_key, "pause": config.record_pause_key, "add_marker": config.record_add_marker_key, } # pylint: disable=too-many-branches # pylint: disable=too-many-return-statements # pylint: disable=too-many-statements def execute(self) -> int: interactive = False append = self.append if self.filename == "": if self.raw: self.print_error( "filename required when recording in raw mode" ) return 1 self.filename = _tmp_path() interactive = True if self.filename == "-": if sys.stdout.isatty(): self.print_error( f"when recording to stdout it must not be TTY - forgot to pipe?" ) return 1 append = False elif os.path.exists(self.filename): if not os.access(self.filename, os.W_OK): self.print_error(f"can't write to {self.filename}") return 1 if os.stat(self.filename).st_size > 0 and self.overwrite: os.remove(self.filename) append = False elif os.stat(self.filename).st_size > 0 and not append: self.print_error(f"{self.filename} already exists, aborting") self.print_error( "use --overwrite option " "if you want to overwrite existing recording" ) self.print_error( "use --append option " "if you want to append to existing recording" ) return 1 else: dir_path = os.path.dirname(os.path.abspath(self.filename)) if not os.path.exists(dir_path): self.print_error(f"directory {dir_path} doesn't exist") return 1 if not os.access(dir_path, os.W_OK): self.print_error(f"directory {dir_path} is not writable") return 1 if append: self.print_warning( f"{self.filename} does not exist, not appending" ) append = False if append: self.print_info(f"appending to asciicast at {self.filename}") else: if self.filename == "-": self.print_info(f"recording asciicast to stdout") else: self.print_info(f"recording asciicast to {self.filename}") if self.command: self.print_info("""exit opened program when you're done""") else: self.print_info( """press <ctrl-d> or type "exit" when you're done""" ) vars_: Any = filter( None, map( (lambda var: var.strip()), # type: ignore self.env_whitelist.split(","), ), ) try: recorder.record( self.filename, command=self.command, append=append, title=self.title, idle_time_limit=self.idle_time_limit, command_env=self.env, capture_env=vars_, record_stdin=self.record_stdin, writer=self.writer, notify=self.notifier.notify, key_bindings=self.key_bindings, cols_override=self.cols_override, rows_override=self.rows_override, ) except IOError as e: self.print_error(f"I/O error: {str(e)}") return 1 except v2.LoadError: self.print_error( "can only append to asciicast v2 format recordings" ) return 1 self.print_info("recording finished") if interactive: if not self.assume_yes: while True: self.print( f"(\x1b[1ms\x1b[0m)ave locally, (\x1b[1mu\x1b[0m)pload to {self.api.hostname()}, (\x1b[1md\x1b[0m)iscard\r\n[s,u,d]? ", end="", force=True, flush=True, ) try: answer = sys.stdin.readline().strip().lower() except KeyboardInterrupt: self.print("") answer = "s" if answer == "s" or answer == "save": self.print_info(f"asciicast saved to {self.filename}") return 0 elif answer == "u" or answer == "upload": break elif answer == "d" or answer == "discard": os.remove(self.filename) self.print_info(f"asciicast discarded") return 0 try: result, warn = self.api.upload_asciicast(self.filename) if warn: self.print_warning(warn) os.remove(self.filename) self.print(result.get("message") or result["url"]) except APIError as e: self.print("\r\x1b[A", end="") self.print_error(f"upload failed: {str(e)}") self.print_error( f"retry later by running: asciinema upload {self.filename}" ) return 1 elif self.filename != "-": self.print_info(f"asciicast saved to {self.filename}") return 0 def _tmp_path() -> Optional[str]: return NamedTemporaryFile(suffix="-ascii.cast", delete=False).name �����������������������������������������������������������������������������������������������������������������������������������������������������asciinema/commands/upload.py������������������������������������������������������������������������0000664�0000000�0000000�00000001645�14515476772�0016476�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������from typing import Any from ..api import APIError from ..config import Config from .command import Command class UploadCommand(Command): def __init__(self, args: Any, config: Config, env: Any) -> None: Command.__init__(self, args, config, env) self.filename = args.filename def execute(self) -> int: try: result, warn = self.api.upload_asciicast(self.filename) if warn: self.print_warning(warn) self.print(result.get("message") or result["url"]) except OSError as e: self.print_error(f"upload failed: {str(e)}") return 1 except APIError as e: self.print_error(f"upload failed: {str(e)}") if e.retryable: self.print_error( f"retry later by running: asciinema upload {self.filename}" ) return 1 return 0 �������������������������������������������������������������������������������������������asciinema/config.py���������������������������������������������������������������������������������0000664�0000000�0000000�00000015466�14515476772�0014664�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import configparser import os from os import path from typing import Any, Dict, Optional from uuid import uuid4 DEFAULT_API_URL: str = "https://asciinema.org" DEFAULT_RECORD_ENV: str = "SHELL,TERM" class ConfigError(Exception): pass class Config: def __init__( self, config_home: Any, env: Optional[Dict[str, str]] = None, ) -> None: self.config_home = config_home self.config_file_path = path.join(config_home, "config") self.install_id_path = path.join(self.config_home, "install-id") self.config = configparser.ConfigParser() self.config.read(self.config_file_path) self.env = env if env is not None else os.environ def upgrade(self) -> None: try: self.install_id except ConfigError: id_ = ( self.__api_token() or self.__user_token() or self.__gen_install_id() ) self.__save_install_id(id_) items = { name: dict(section) for (name, section) in self.config.items() } if items in ( {"DEFAULT": {}, "api": {"token": id_}}, {"DEFAULT": {}, "user": {"token": id_}}, ): os.remove(self.config_file_path) if self.env.get("ASCIINEMA_API_TOKEN"): raise ConfigError( "ASCIINEMA_API_TOKEN variable is no longer supported" ", please use ASCIINEMA_INSTALL_ID instead" ) def __read_install_id(self) -> Optional[str]: p = self.install_id_path if path.isfile(p): with open(p, "r", encoding="utf-8") as f: return f.read().strip() return None @staticmethod def __gen_install_id() -> str: return f"{uuid4()}" def __save_install_id(self, id_: str) -> None: self.__create_config_home() with open(self.install_id_path, "w", encoding="utf-8") as f: f.write(id_) def __create_config_home(self) -> None: if not path.exists(self.config_home): os.makedirs(self.config_home) def __api_token(self) -> Optional[str]: try: return self.config.get("api", "token") except (configparser.NoOptionError, configparser.NoSectionError): return None def __user_token(self) -> Optional[str]: try: return self.config.get("user", "token") except (configparser.NoOptionError, configparser.NoSectionError): return None @property def install_id(self) -> str: id_ = self.env.get("ASCIINEMA_INSTALL_ID") or self.__read_install_id() if id_: return id_ raise ConfigError("no install ID found") @property def api_url(self) -> str: return self.env.get( "ASCIINEMA_API_URL", self.config.get("api", "url", fallback=DEFAULT_API_URL), ) @property def record_stdin(self) -> bool: return self.config.getboolean("record", "stdin", fallback=False) @property def record_command(self) -> Optional[str]: return self.config.get("record", "command", fallback=None) @property def record_env(self) -> str: return self.config.get("record", "env", fallback=DEFAULT_RECORD_ENV) @property def record_idle_time_limit(self) -> Optional[float]: fallback = self.config.getfloat( "record", "maxwait", fallback=None ) # pre 2.0 return self.config.getfloat( "record", "idle_time_limit", fallback=fallback ) @property def record_yes(self) -> bool: return self.config.getboolean("record", "yes", fallback=False) @property def record_quiet(self) -> bool: return self.config.getboolean("record", "quiet", fallback=False) @property def record_prefix_key(self) -> Any: return self.__get_key("record", "prefix") @property def record_pause_key(self) -> Any: return self.__get_key("record", "pause", "C-\\") @property def record_add_marker_key(self) -> Any: return self.__get_key("record", "add_marker") @property def play_idle_time_limit(self) -> Optional[float]: fallback = self.config.getfloat( "play", "maxwait", fallback=None ) # pre 2.0 return self.config.getfloat( "play", "idle_time_limit", fallback=fallback ) @property def play_speed(self) -> float: return self.config.getfloat("play", "speed", fallback=1.0) @property def play_pause_key(self) -> Any: return self.__get_key("play", "pause", " ") @property def play_step_key(self) -> Any: return self.__get_key("play", "step", ".") @property def play_next_marker_key(self) -> Any: return self.__get_key("play", "next_marker", "]") @property def notifications_enabled(self) -> bool: return self.config.getboolean( "notifications", "enabled", fallback=True ) @property def notifications_command(self) -> Optional[str]: return self.config.get("notifications", "command", fallback=None) def __get_key(self, section: str, name: str, default: Any = None) -> Any: key = self.config.get(section, f"{name}_key", fallback=default) if key: if len(key) == 3: upper_key = key.upper() if upper_key[0] == "C" and upper_key[1] == "-": return bytes([ord(upper_key[2]) - 0x40]) raise ConfigError( f"invalid {name} key definition '{key}' - use" f": {name}_key = C-x (with control key modifier)" f", or {name}_key = x (with no modifier)" ) return key.encode("utf-8") return None def get_config_home(env: Any = None) -> Any: if env is None: env = os.environ env_asciinema_config_home = env.get("ASCIINEMA_CONFIG_HOME") env_xdg_config_home = env.get("XDG_CONFIG_HOME") env_home = env.get("HOME") config_home: Optional[str] = None if env_asciinema_config_home: config_home = env_asciinema_config_home elif env_xdg_config_home: config_home = path.join(env_xdg_config_home, "asciinema") elif env_home: if path.isfile(path.join(env_home, ".asciinema", "config")): # location for versions < 1.1 config_home = path.join(env_home, ".asciinema") else: config_home = path.join(env_home, ".config", "asciinema") else: raise Exception( "need $HOME or $XDG_CONFIG_HOME or $ASCIINEMA_CONFIG_HOME" ) return config_home def load(env: Any = None) -> Config: if env is None: env = os.environ config = Config(get_config_home(env), env) config.upgrade() return config ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/data/�������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0013742�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/data/icon-256x256.png���������������������������������������������������������������������0000664�0000000�0000000�00000061300�14515476772�0016337�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��������� t%���gAMA�� a��� cHRM��z&���������u0��`��:��pQ<���bKGD X���tIME (J3��aIDATxuT?]"͒ HX(&*3)EB@ADA@@]BT٘{?sAٝ=̙9O|CHQ`v�*CV\L[e�f6�DMWEQ6wǹ�6&DSWK4�L ]T_xb((y-wE1�DY2gr[MaL/ڮg2]r IؼEQ%[v ؎�K7Ff_ 7P!�r9 %zj(-`aC}+ͯ.C;�F_.Ӈ�I! @:"u�DHQEQryeA!`Gg h pn2Z~dXV(1ENЮ6~(r ɒmOS<ʗ@f%IcpPbEž-Z+W;(l)yn  �xkJ�v)]u%�9s=5EQE>p(!9TY|BM)pr EGGЦ @2RWQEQ�8 w)gñ�zq$@ v͡Pbd�S|y-y8SEQB^IX (&'m;p@ܱF�9`}��kz9ONNEQ=�1oSb0P b=aw)%@O,pr � PQEQr3�8 w3.?*>ȷpJozNrym#�7 hh)ߎ((Ųd/ P04�:8xb|Xr<bʒ>�7:#"\)Gb�LÆ(( A=�N` ʼnkCo@յba+[L9Q �‹%zj(JAF F;Ay�S~GO4}�l5�m(Te 푑R'SQE%I!Eo�pvi�a[ �Gor�x`"e�TXQE&px 9liwàFt{`br�(jT+]�_Օe!PEQ尢!(:πIwav<br?�4U[b@d'�ի'z(J^F=�9 �iq�Z|" >. v<i�KC'ԀSEQ%$@5ا @7�-oGд")@%TKȍ��Ae@sEQ@=�ϵ7n@Y�U*$80�wMOTFX ;(]HwǸh }c�\`6t߾Tzr�{`W @dih.(P@&(Nq7Rn Ʌ3g "͊ZU>4hToUEQ *j�-܁gA"*~ .#Ks<5ֿۖȍx9M (0�ț`[K?XB1�|| v9@p(.eBl7�PEQ9j�_]3(@+j4+?ƽn�w  } Z.9DOLQE�ȟų\WŇ�dzF-2? I[曼5�f}h2`ˀ(�(j{+^JUW`5�d&1%#W(*Zf(Q`qh{2Q(<j<p&7Lz<\_v(t}]ZՉ(OP`s1�~!0( pעL2s>h pIf"@җ!"ezK(zF w`�(5>�8qt? nkamrgR�xX%EQr Pq;I[Pnn|ƬT�ǥj;_B؝�^sPE@;3K�0ɜP<tJ7�ffƭ2Pko\l�j%z( �(3RA/8 (86�_�FD-E8R{h{0-A(c W9D\7~rPt\0W~r3=T ) 9a'�آd$is5EQÎz�8T( PjZ�n+*@[pđ%�^{�mde=%EQ�Jv7�h PSY0~Xl$EK7JwÈ(JF �%' rrCSΠ)@ۊ ~7`>V\Lhڷ2`n\EQ9�J"q͆샮Gip$[|exs()V�ė6+0 (JnE=�Jn .TA�Gn\tɭc+�n>< PnFhD�BK&zj(5�ȡO�s4K a�^tG5f� *#(~�PDLQ *Ǥ48Nx} 0 :-X�sh2`ڍ~E) Pɋ/'�n.JWO>E x}Kr�RnŊ84 PQ;1RfX}#c$-v/s�*$IZ�$j[7STE'܁]U>"2+@O�f�>pFI&$JRkj(+܁q@4j`bU�o;@Ljpδo'(ʿE=�JA"B_Ytʧl3`򚣋&@3ғ�;Y.! Xh(y�(?jo܈jU6K?dNN3mw)`ẅ4M @Ĉ )*9Pi *�*KaG0M3`�6Or$+(5�Ϲ(PQ.� 3`\E?EhPGR=.; ߛ(!)_t5J)�(VBVVs o2/ޕBK?)EQ}mo�8 �6\P^S�?ALh{cEQ(ϝ@T~QWy]exo7 S _a)M�(@QA{;1�%s$@[KxK k5#iT%E.�PO`.TS)Phg 0[ GU�e2ō0�7�oIE/(O Qɵ7t)F5Zt^ix3@/tƊ4@QrS$crL*AY5d)x{ `PnX\ʴ W}!W�{HN=AEQr?P7$�Hiq�׭7E�&m3<"K�&W!;(ʟ�E=ho,冾bTKςRWK >)gxvFyPZ#兑͟m2ST%�Eɽ"I"#4i��4@䑬�P EQ�P<D Q<•v"M༏DW͛9 CWl)�b˥iizP%d†<跓@L�L5Ik pwm$�~Dz5R P@Q>D>7Wθ#@_ .◥"e.�.@䭷=5EQ 5�%HʿL`W0o@(�D(#^qE( wI[S]T0ބ<�NKd� @|kr<)Q@Q l1(pC9}n}�VF;Nw~9Wu= EC(pKD(Mg>s�^| `K˅i*Q(y5�E r}*mOG_B/ y 8v>h zoU%7(D9ƛs!@Gʘ]�01fnxjToZhABNzh2@s%W(E`lj߹]P-�w pC] ZC ,A=rhQ(5�E]aEZ{.x1�c6�g(Te� 푑R3Ŋ(% &g ]z:>n�o| [�Mu�z[,.oIQ)r 9l"kaPv#�_=0V�=@e�i9| .4w@Q+rS%}{R�&ԈHWG6_�:` nGLQ\]Q2�DJAzDOQQ.(d'[=K S 37/Jq�/�->GM{ z�"B [/nt#( 5�+ IsTޒo9]ů1AJ$qe_�ocԿ#r `�K()B-0Eː2 dm2�wRnMqMoJNxjHb<\!6U 3N> 0'0[I_N'W�P<6TD’jRS?^(VSZC:A<oO^HSW b{ ʉ�O&ٺ�WR�an$<j\QC <4KIΜBYWՈ�\)M�:`kB�DtI%ή;`]{@Wly `tV�#7/.T0]MtE QIc8�uعK�Krɫ@hZy�ɢ7@#WQ &(Xɐ³�)2�S�=}ZI5BO89e$I A`(P%@C'0`\o�!nD]($ {]΋3ҟ�y? 2 N=X;W]P 'z~JPd'AGJ;�oG�.ohBX PJJ(ُ�.��Bf77D_5` ^�/fw du'$Dv:M]9Y Meu7ھp^sA<`Ľd7V)j�(Q7�'rnFudK2 01Ə�{2å JNH䒊 i4'|0r9 `b4_�w=�+\?PJ@ �OIG<t)�3 ~]0= La8c@|xCP;UJNrTux](J@:ċy i8ZwHSsWͤU1JDEF�0nc)�{^#�#IΗ+KgE f܎J6jE>뎾k;C/w)UGJʋ9oTn\Ԕq#ǒ� VV(z�EtmupHRMrY�M 4y�?y�[ޑ'{#g`Z= SD%g�ey5݁fhΕrr3�cz3 :@̰[3HYn\�a!YdEʬ)+�@ڐx];�;�SOg @d*W4w 3t1a-�_`q&@?r'Ax9_*ʄ7R E;W64.#I)##[%_H%[hp�̽rnnao,@�qIܘ^%KAp^ + λ�& k` L'=]r8q;c-)Pn<~PI*T՛pv8򛤚29�?OC]JBQ@V5c:�Ĭs5QHh�j REpFR{UvkvMV;݁SjXۂs X�3 Ylx[k@x�S5�<<鉞V67t�JKMrG S�W)@+[Fm� zuD4F(6eIz�/6�~8 c4^ Bޛ/;i pa!9$dC!KX-1q0'<m�0E ҄w @]ik?" C*hIk8Hs-2 XXy0XΩd3PJå�܁�DBr+Kŝ�^v;c�>" TfSYbBNMoP/�L.v�`z 毝ΔώJr Kݒ0W4!EU`1箖w%s# NILJ_,%W<Ĝ �wu�]Gx`I\8{ uA%7|AnF�S]!u^`Y�u{|G/sU8LGIUߞJ�r>+v"@%f�ti'�Pr%̐;wMq�iOt;|f49#)B@?KrʋEX `|b/$ wt4;y.9dG8C`!<�N\g5S�&tM(վ Pt/`Nhxh"`D �%O4= P;oL)S{mpqy>�sv]$u 꼷C;F�Y7 =e'Nn/bPm�D38K%u3'L mi{�f [cLy'hjzWQj�(yd$׿]�D,7~M{kbD8PAs7|" zt�Ӏ�^=j~w!x�Sŕ p}5w9ař�2`>-bNY?H4�/G]7C-3T5�|A�Dr^<y�& sŶ5�pm3]@Lv~cQ�fj�0W ',9�T4 ݟMI C X(>2]>&�ώa(AH45jipƥy,96*4c !]@4'ǰ\`-ČԣO!=q}E Qx `.QFe9 $D0q;o%)ph �^U)+@+5�|M#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ytwf�*ƞX\!R R{HN=܎8\ŢEr\.1UeG'(y;`b%9qOЮK<&U>fD2d:_^li[kSft/؄]E{OoDăw]i`nq=xHpW$c ~b@$zb�(��ĭ(EZp1I;N-bsH2Q_\K_wEl\/KH�[}NQ?#(:!E V&(|YAxq�*dҋ#RRq=܁z�5�6� ~{By&gvH*i?49LcمQ1�-�og:tW A:Wf33p N��R�QHP �Ho  A^)J9_ + VƮ&vM-S/<)UM$Qf>'ݭl$(.dܧ @T1<;Gvޚh�rƹ�/WrX!!EW;7N%[ v;۞�E/.8Oʁ&{KK̯~/JD­/F=�s3ʻ$K&lHY�x*C϶\0i|KPƍ ~pZ(�P+i @k@мгY@Jpzx .ߤ* adQ�$'pU8lwCvJ6z(فq'e}6MhP$EyYi2 Ծ 'SVDr*Q&,;PKDO;(?}K=ǫ`R' ! $AwK}~ s5=3V\.7d=Hu[ࢍ|0�!{8uJNHPX*.y`J hU%@h^.�ѺPIjߎQ@G8INR2` �,�[\oog]-߸%%o?*XxJ&jL\KfJMlW-֗ˌ4S ;eH�A-*!=eoe+DBWAֽC(*Jva-,pvҽ�OUdZOr_dK_+KH3ޯ�P�X'cBSଡ0nw[, N! A%sD~U]n.Jݢ%?]�UJ&y4�ҵ-$ QNxwpI%%z{APw[Qw U14|Yp w5�*nvuq@AcK��<�_bDRN�4Y�=o^]"䱟`>OKX7F\anX?DyZagI6i ;?t׭{Щ4kY�[�ر�;p)@oh pd_1 }nȇ&(Jv_Fy!X>:?`f)� iS,]HsmKo pVXvv6 wV3-UX p09}nrAMKIۤ)kwxmXm3r,|uiJ�|�{(aN^Hv .>՜%' g;݁]E+8a(ݓeh gR\Jj *rY.y j)-op7*obsI O|.XKp2�bf$@ɳ]�ϕ}BҬrx9ԓdiN�${�dn5f; 4^hRHSb~=bze�)+{%IEG 1%=,3WLQlhB�rj x};�hy`ݾ@CP9Q _�_C@p-@v>-eq}W2={#yi% `P3`~dUed- \�bj%vBNʌpݝ7-Z\\k5!!unS}#].7. fkE1sқ�ۯ2Yr.aC9 hUAAL_q{ҝ @Dxj01ֹ/Q'�}*?U3!tw$$[H4= @2Ww'Ώ�Ͽ$] 0d_N|M;Q~~0Q|64w^҅0f7f' �垾15)jvKV Wksp`ݞ,5)/vKV?:�+=q7$)PYoP|W(kY�ȟXdnvؙЮpz{iWЄCs8r rJ�$S9v@u�3;S$|@cF 2s9A�X� ϣ{�xOϑPU G*JG!| T �lB�;q]s� ʔSF�S0X~X~`Z�X9`p&�o.-_fx*JN]Pgl5"(oW�{J s9/=Z4qI}\U*MTȡI5\2t8%�#Z%X\hq$@�Ud)qI֩y�i v'&Ur7{8KKTOT1O Pj/eyZg9dFr}1]Yi٣c�?.4c՛q�gW@ɖn6owTJ"p;dм#".c_`fүuW>@a?�$xP KI}bY"kq;v<i{z#JUekr;`~hs%=O'#ť87b�4ϑK?>@KD*:Y+Wu3~,R $Ntwe&Iɾ0'J|͍4 DY3j�nsr ԕ2SY@7{N%94Wc%v6�6x)ޤb4 D>h\J'}�?K\�k\r=�n)e| h\Lf7JN˻7DڦI{l2Z_V[#�/V j�6[�|"#Ur%đo{_VeV~ e>{q0: 7�DNЧ˗fP{]θ�n2V;N+Oa'z^JX|n} �oaw}T8M�y&&b1^q?��Sž`H6)uu>/ `[:�Hm_%$5|xē#�"+�j,@ϻ8jz.w_v]ݰWAԹ;�O*H2|>P7xFP5@idg0]^_i%7E _z9IY- uEyOs@Iҕ5rP'D �l{zœpg\3U?^UYMvS_oڸv^=qGIs?�xj `i&,H.dP 98>Y#p JӔε8(vA8�,3?KB1\%;鶕\Mg�DowxN(s�nO({L)ӻ g4,;'o_~m/~*JaI[RU3v71�lHMd[# q y&DOQ [_)"QNӗWvمP'3q=�?W 0E5eMqF=R˷Dz !n/Hzٔ�h G 9b͟Jbi><69}�Gr1|rr� <ωXv"WƗQsL0U�ԑv^r k?؛�v HwHπ�F#.5}�o.yϳu yGRJh;7y(x;7=/@o߯w�d_K='�eΔ1��PpúLL0Q?�s(+}Rd]%mt6#̩�&�2E>vW Rs+0(RR�0QIF �?½1�ZnɔV m{D;׾*檒ez5e.]1`໢ N#`WyM⣊\h�qgHY)� jRW ~Nph~-d66�L,).g�~7T\uy nwHȭ-Zey(1 Co^F*.y]#S Σf܆ɜ~ų֗De)�{`5PFKni,s8Q8Xr7*{4'1SH�>�q"bA~.3�FO)׬MXWMw?~Ҏ Oyba$ Qx1~Xl{Q3&aT|wcU7) P"Uo<' 0�|X,N.rrk;c% ]x@r�S> `9~|e$g84�6Y/P܀\H;),8ç]Ep離Gpb�nZ JI%urk?6);{3% MMvuZVt5"u� s}.@t)KE-w�x10 )G94,6[vA7 %E|4rr9E2ԫ]~L'JWq"@%UINA %wŵ |%' b?u�c|] K5HדOkuS�|`&3,ķEX1_�+5�6U�/|'))p`p:DD4",>OG{BeVISb_{'z~J"[ϩK"C}]>I)Ɗ"*(Q]n�AO<r5WI6Ÿ#}A6y0�r_*cTqƇR%y)� ?M3�Zt@ύr\ꔔ}LUۑk�;F$bRn;?`a%w8@.j(q{LN%%otO$s?n~$+v2z�AQQ T5b䮑k%uoE�5 �MB+W՗kw87lw~%HvS{yS�a;n7|0ͻ )WZQ4]^�WG͋�ezX@ܢ�l-W=_~ <F6@}7n.ɔle(Eڊv9q+]̵.k5AOC=(|w_4>i{Is4֑�E—l@mg�\_t*r}.@|=%YE_br%&e$) n4y�^O}CO2�5SƩ'y&'#�_b�g=ŵyd)@Iئ opss nحR8D:q;SC? X5*C^:|".ߦDO`@,a|�=J&i3B%=EZ~X(@§va(�^"]{f`+t@ 8?K<eV;O];Kt0H5^;�ė�3Z`ZD>'Ә�<u/yw\PPPd _D"~eE'ѯ.E/po6K~_�~cde'n uyF;{o_^8*Vn\}Gv5k_* 7_Wٵ= �!.i=Oɕ!G6_@eWmp(\ �'x^bHȻ '@^';x#eh\#mswwdeWKr^ntGOu?(Lz&II?%sN:ˮ!ϫ׈U& sG-#.}vHՔ+Q^OԔ�DX1�lot*藙CL/H:{ZQDk^N?(֑%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^�&JQ/j�(JwTi͓4~x7 imu)e*ؓq㹇=1EQ (J!_\?} Ljt}�4�RoU0;ח6$䮢H(L Xt6 \J=w*m�|'i�͟mP]EQP@Qr=UOd;|0<+�F-MX6\%B<%{׾+;4(D2/,J a�\TBV'F`}MJOzrް!|EQ�(Js{"r3Jݹ}Yoah*_�dn f~� Rg;�Q�4(?@=�JNc%kl?X;N2tmH57�dzPx,(�('p\^%95 3ؾ0�-8V˅Ez7NDOMQ�r׀v^J\c�ؽnT�B �TrWQlD �Ek83<�ƛ-�t}xJ��:AU%�ERε:!�Eᄒ\pI�oo9}#"x e (J�Ecϕ=nR7KX0MVb�~OH �͙f+ P@Q~O uvlؽQb3nb�|kd,/L.�PƲD{GH=~�P_k7LK!Cr@k@49*>�P "naӿ͏e�w9�oG6 ʕGqr^=@EC$N3(;-( 0$  %5�̈tYU� "sEɳgX~7WK͕),0�sҎq;p]1.zW%ϣqu  {<~~`¿S4 �ᤛՕU%ߡ9>W\#i|0}F/6/c0TCF肯(J@ �%/}K|o w�S:3`|ӿh'�;6\%C�}+R`P@ \,926 |j]{/r^gT'@E) be݂�-�,'sd\v d<SZ�B2R)2=EQz�@znafg"Lx8ൢ�k~Yn+05 NDOMQ%wHϸ~Gu*޻0N�_�n�@g+%j�(9I[ȩWWγK=ysbEB�Ud\ @hGM+(Pε{xCVS p k�&51X(�&>Vl h\EQz�w zv�x)`BK& #/KJS4�܏nF(JB �puB<w+k�ϬX0ޮ~YmpUEv�P A,?Y^q)N y``#z}`%$@VP>EQC �ph.\Yd/lo }c;~�ܖ)L�P`8n$op(Mc�p|t#$Y^(5�H^!^G;=�s^d0@U^:#�6*3�7Ս'h,_Q%@&=H?׽`Pyi;n)d4�'O \�bj1SEQ5� =L#&i$?t.zG0pbSBo�V(�(sGX~[fBq)``Ļ`Q^5]y�z(y5�'A,z-<Y�|Þпt՛Y(qzv@%wEQ j�X~y'3�vSR` ~@Hz2^`WEQ% or�`: S�.\>mwHQ �DOMQE :~\vUc!T?&k. ?b&N(.}+0�ݸ4'<_PJ �w6�>@�DJL?ڥoUEQ *j�.F,X(cϷu ظN+c#2@qk,_QE95�rK�[x.�zFF@W �[ٍ'k_QEQ 1^馷:pY/ 0q|&@tmqc+�nPP]EQ@S v��S.S@XG�ի*(K�Iyv1o|w鏬bx=`.s\9Qj|*|EQ0:�}tYղ$ p]C-yƀEQÌz�bJy+@z 攠:@3Cc�>27- @_\Fn<Ac(JF [ l]w�ה2ښ�WX`%~ F�t~ ^EQ%GPshcSL|h~`ݪ,�NW�sLC�b<)(5�\(GS�vO�^2#G EkO+ X䮢(P@$w۸X~{y$s�t?@�3H?}�4*(J�A,;o�҆�`h;Mo1Rb�-SEQ�\eS2�6>0M=�Ê)Cƥ.zo8'<h\EQESw }I(0#l�P>V`���Buŵ|EQ%_ ص=B! ?b@M�DRG>WQEɧu h[LNMݯoG3`"ʎذ r52@- D)(JW }n"( Ljn�|ynE9[RxDOLQEQrb�eΐzq̺N_{ e/<Qe.TrWQE)r)`S]P)U7i0k kI lܞ (hr p'7I�XwlQDX_,{7&�LHNEQ%8 ̑Mt>o&5�}K�K4Oد dz;T|4((F �G;�ncW`z7 -?H�DEQC9���%tEXtdate:create�2019-02-02T11:30:33+01:00t���%tEXtdate:modify�2019-02-02T11:30:33+01:00����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/file_writer.py����������������������������������������������������������������������������0000664�0000000�0000000�00000001547�14515476772�0015725�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������from typing import IO, Any, Callable, Optional class file_writer: def __init__( self, path: str, on_error: Optional[Callable[[str], None]] = None, ) -> None: self.path = path self.file: Optional[IO[Any]] = None self.on_error = on_error or noop def __enter__(self) -> Any: self._open_file() return self def __exit__( self, exc_type: str, exc_value: str, exc_traceback: str ) -> None: assert self.file is not None self.file.close() def _open_file(self) -> None: raise NotImplementedError def _write(self, data: Any) -> None: try: self.file.write(data) # type: ignore except IOError as e: self.on_error("Write error, recording suspended") raise e def noop(_: Any) -> None: return None ���������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/http_adapter.py���������������������������������������������������������������������������0000664�0000000�0000000�00000000057�14515476772�0016064�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������class HTTPConnectionError(Exception): pass ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/notifier.py�������������������������������������������������������������������������������0000664�0000000�0000000�00000006343�14515476772�0015230�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import shutil import subprocess from os import environ, path from typing import Dict, List, Optional, Union class Notifier: def __init__(self, cmd: str) -> None: self.cmd = cmd @staticmethod def get_icon_path() -> Optional[str]: path_ = path.join( path.dirname(path.realpath(__file__)), "data/icon-256x256.png", ) if path.exists(path_): return path_ return None def args(self, _text: str) -> List[str]: return ["/bin/sh", "-c", self.cmd] def is_available(self) -> bool: return shutil.which(self.cmd) is not None def notify(self, text: str) -> None: # We do not want to raise a `CalledProcessError` on command failure. # pylint: disable=subprocess-run-check # We do not want to print *ANYTHING* to the terminal # so we capture and ignore all output subprocess.run(self.args(text), capture_output=True) class AppleScriptNotifier(Notifier): def __init__(self) -> None: super().__init__("osascript") def args(self, text: str) -> List[str]: text = text.replace('"', '\\"') return [ self.cmd, "-e", f'display notification "{text}" with title "asciinema"', ] class LibNotifyNotifier(Notifier): def __init__(self) -> None: super().__init__("notify-send") def args(self, text: str) -> List[str]: icon_path = self.get_icon_path() if icon_path is not None: return [self.cmd, "-i", icon_path, "asciinema", text] return [self.cmd, "asciinema", text] class TerminalNotifier(Notifier): def __init__(self) -> None: super().__init__("terminal-notifier") def args(self, text: str) -> List[str]: icon_path = self.get_icon_path() if icon_path is not None: return [ "terminal-notifier", "-title", "asciinema", "-message", text, "-appIcon", icon_path, ] return [ "terminal-notifier", "-title", "asciinema", "-message", text, ] class CustomCommandNotifier(Notifier): def env(self, text: str) -> Dict[str, str]: icon_path = self.get_icon_path() env = environ.copy() env["TEXT"] = text if icon_path is not None: env["ICON_PATH"] = icon_path return env def notify(self, text: str) -> None: # We do not want to raise a `CalledProcessError` on command failure. # pylint: disable=subprocess-run-check subprocess.run( self.args(text), env=self.env(text), capture_output=True ) class NoopNotifier: # pylint: disable=too-few-public-methods def notify(self, text: str) -> None: pass def get_notifier( enabled: bool = True, command: Optional[str] = None ) -> Union[Notifier, NoopNotifier]: if enabled: if command: return CustomCommandNotifier(command) for c in [TerminalNotifier, AppleScriptNotifier, LibNotifyNotifier]: n = c() if n.is_available(): return n return NoopNotifier() ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/player.py���������������������������������������������������������������������������������0000664�0000000�0000000�00000013651�14515476772�0014705�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import json import sys import time from typing import Any, Dict, Optional, TextIO, Union from .asciicast import events as ev from .asciicast.v1 import Asciicast as v1 from .asciicast.v2 import Asciicast as v2 from .tty_ import raw, read_blocking Header = Dict[str, Any] class RawOutput: def __init__(self, stream: Optional[str]) -> None: self.stream = stream or "o" def start(self, _header: Header) -> None: pass def write(self, _time: float, event_type: str, data: str) -> None: if event_type == self.stream: sys.stdout.write(data) sys.stdout.flush() class AsciicastOutput: def __init__(self, stream: Optional[str]) -> None: self.stream = stream def start(self, header: Header) -> None: self.__write_line(header) def write(self, time: float, event_type: str, data: str) -> None: if self.stream in [None, event_type]: self.__write_line([time, event_type, data]) def __write_line(self, obj: Any) -> None: line = json.dumps( obj, ensure_ascii=False, indent=None, separators=(", ", ": ") ) sys.stdout.write(f"{line}\r\n") sys.stdout.flush() Output = Union[RawOutput, AsciicastOutput] class Player: # pylint: disable=too-few-public-methods def play( self, asciicast: Union[v1, v2], idle_time_limit: Optional[int] = None, speed: float = 1.0, key_bindings: Optional[Dict[str, Any]] = None, out_fmt: str = "raw", stream: Optional[str] = None, pause_on_markers: bool = False, ) -> None: if key_bindings is None: key_bindings = {} output: Output = ( RawOutput(stream) if out_fmt == "raw" else AsciicastOutput(stream) ) try: with open("/dev/tty", "rt", encoding="utf-8") as stdin: with raw(stdin.fileno()): self._play( asciicast, idle_time_limit, speed, stdin, key_bindings, output, pause_on_markers, ) except IOError: self._play( asciicast, idle_time_limit, speed, None, key_bindings, output, False, ) @staticmethod def _play( # pylint: disable=too-many-locals asciicast: Union[v1, v2], idle_time_limit: Optional[int], speed: float, stdin: Optional[TextIO], key_bindings: Dict[str, Any], output: Output, pause_on_markers: bool, ) -> None: idle_time_limit = idle_time_limit or asciicast.idle_time_limit pause_key = key_bindings.get("pause") step_key = key_bindings.get("step") next_marker_key = key_bindings.get("next_marker") events = asciicast.events() events = ev.to_relative_time(events) events = ev.cap_relative_time(events, idle_time_limit) events = ev.to_absolute_time(events) events = ev.adjust_speed(events, speed) output.start(asciicast.v2_header) ctrl_c = False pause_elapsed_time: Optional[float] = None events_iter = iter(events) start_time = time.perf_counter() def wait(timeout: int) -> bytes: if stdin is not None: return read_blocking(stdin.fileno(), timeout) return b"" def next_event() -> Any: try: return events_iter.__next__() except StopIteration: return (None, None, None) time_, event_type, text = next_event() while time_ is not None and not ctrl_c: if pause_elapsed_time: while time_ is not None: key = wait(1000) if 0x03 in key: # ctrl-c ctrl_c = True break if key == pause_key: assert pause_elapsed_time is not None start_time = time.perf_counter() - pause_elapsed_time pause_elapsed_time = None break if key == step_key: pause_elapsed_time = time_ output.write(time_, event_type, text) time_, event_type, text = next_event() elif key == next_marker_key: while time_ is not None and event_type != "m": output.write(time_, event_type, text) time_, event_type, text = next_event() if time_ is not None: output.write(time_, event_type, text) pause_elapsed_time = time_ time_, event_type, text = next_event() else: while time_ is not None: elapsed_wall_time = time.perf_counter() - start_time delay = time_ - elapsed_wall_time key = b"" if delay > 0: key = wait(delay) if 0x03 in key: # ctrl-c ctrl_c = True break elif key == pause_key: pause_elapsed_time = time.perf_counter() - start_time break else: output.write(time_, event_type, text) if event_type == "m" and pause_on_markers: pause_elapsed_time = time_ time_, event_type, text = next_event() break time_, event_type, text = next_event() if ctrl_c: raise KeyboardInterrupt() ���������������������������������������������������������������������������������������asciinema/pty_.py�����������������������������������������������������������������������������������0000664�0000000�0000000�00000014643�14515476772�0014366�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import array import fcntl import os import pty import select import signal import struct import termios import time from typing import Any, Callable, Dict, List, Optional, Tuple from .tty_ import raw EXIT_SIGNALS = [ signal.SIGCHLD, signal.SIGHUP, signal.SIGTERM, signal.SIGQUIT, ] READ_LEN = 256 * 1024 # pylint: disable=too-many-arguments,too-many-locals,too-many-statements def record( command: Any, env: Dict[str, str], writer: Any, get_tty_size: Callable[[], Tuple[int, int]], notify: Callable[[str], None], key_bindings: Dict[str, Any], tty_stdin_fd: int = pty.STDIN_FILENO, tty_stdout_fd: int = pty.STDOUT_FILENO, ) -> None: pty_fd: Any = None start_time: Optional[float] = None pause_time: Optional[float] = None prefix_mode: bool = False prefix_key = key_bindings.get("prefix") pause_key = key_bindings.get("pause") add_marker_key = key_bindings.get("add_marker") input_data = bytes() def handle_resize() -> None: size = get_tty_size() set_pty_size(size) assert start_time is not None writer.write_resize(time.perf_counter() - start_time, size) def set_pty_size(size: Tuple[int, int]) -> None: cols, rows = size buf = array.array("h", [rows, cols, 0, 0]) fcntl.ioctl(pty_fd, termios.TIOCSWINSZ, buf) def handle_master_read(data: Any) -> None: remaining_data = memoryview(data) while remaining_data: n = os.write(tty_stdout_fd, remaining_data) remaining_data = remaining_data[n:] if not pause_time: assert start_time is not None writer.write_stdout(time.perf_counter() - start_time, data) def handle_stdin_read(data: Any) -> None: nonlocal input_data nonlocal pause_time nonlocal start_time nonlocal prefix_mode if not prefix_mode and prefix_key and data == prefix_key: prefix_mode = True return if prefix_mode or ( not prefix_key and data in [pause_key, add_marker_key] ): prefix_mode = False if data == pause_key: if pause_time: assert start_time is not None start_time += time.perf_counter() - pause_time pause_time = None notify("Resumed recording") else: pause_time = time.perf_counter() notify("Paused recording") elif data == add_marker_key: assert start_time is not None writer.write_marker(time.perf_counter() - start_time) notify("Marker added") return input_data += data # save stdin unless paused or data is OSC response (e.g. \x1b]11;?\x07) if not pause_time and not ( len(data) > 2 and data[0] == 0x1B and data[1] == 0x5D and data[-1] == 0x07 ): assert start_time is not None writer.write_stdin(time.perf_counter() - start_time, data) def copy(signal_fd: int) -> None: # pylint: disable=too-many-branches nonlocal input_data crfds = [pty_fd, tty_stdin_fd, signal_fd] while True: if len(input_data) > 0: cwfds = [pty_fd] else: cwfds = [] try: rfds, wfds, _ = select.select(crfds, cwfds, []) except KeyboardInterrupt: if tty_stdin_fd in crfds: crfds.remove(tty_stdin_fd) break if pty_fd in rfds: try: data = os.read(pty_fd, READ_LEN) except OSError as e: data = b"" if not data: # Reached EOF. break else: handle_master_read(data) if tty_stdin_fd in rfds: data = os.read(tty_stdin_fd, READ_LEN) if not data: if tty_stdin_fd in crfds: crfds.remove(tty_stdin_fd) else: handle_stdin_read(data) if signal_fd in rfds: data = os.read(signal_fd, READ_LEN) if data: signals = struct.unpack(f"{len(data)}B", data) for sig in signals: if sig in EXIT_SIGNALS: crfds.remove(signal_fd) if sig == signal.SIGWINCH: handle_resize() if pty_fd in wfds: try: n = os.write(pty_fd, input_data) input_data = input_data[n:] except BlockingIOError: pass pid, pty_fd = pty.fork() if pid == pty.CHILD: signal.signal(signal.SIGPIPE, signal.SIG_DFL) os.execvpe(command[0], command, env) flags = fcntl.fcntl(pty_fd, fcntl.F_GETFL, 0) | os.O_NONBLOCK fcntl.fcntl(pty_fd, fcntl.F_SETFL, flags) start_time = time.perf_counter() set_pty_size(get_tty_size()) with SignalFD(EXIT_SIGNALS + [signal.SIGWINCH]) as sig_fd: with raw(tty_stdin_fd): try: copy(sig_fd) os.close(pty_fd) except (IOError, OSError): pass os.waitpid(pid, 0) class SignalFD: def __init__(self, signals: List[signal.Signals]) -> None: self.signals = signals self.orig_handlers: List[Tuple[signal.Signals, Any]] = [] self.orig_wakeup_fd: Optional[int] = None def __enter__(self) -> int: r, w = os.pipe() flags = fcntl.fcntl(w, fcntl.F_GETFL, 0) | os.O_NONBLOCK fcntl.fcntl(w, fcntl.F_SETFL, flags) self.orig_wakeup_fd = signal.set_wakeup_fd(w) for sig, handler in self._noop_handlers(self.signals): self.orig_handlers.append((sig, signal.signal(sig, handler))) return r def __exit__(self, type_: str, value: str, traceback: str) -> None: assert self.orig_wakeup_fd is not None signal.set_wakeup_fd(self.orig_wakeup_fd) for sig, handler in self.orig_handlers: signal.signal(sig, handler) @staticmethod def _noop_handlers( signals: List[signal.Signals], ) -> List[Tuple[signal.Signals, Any]]: return list(map(lambda s: (s, lambda signal, frame: None), signals)) ���������������������������������������������������������������������������������������������asciinema/py.typed����������������������������������������������������������������������������������0000664�0000000�0000000�00000000000�14515476772�0014516�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������asciinema/recorder.py�������������������������������������������������������������������������������0000664�0000000�0000000�00000013641�14515476772�0015215�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import os import sys import time from typing import Any, Callable, Dict, List, Optional, TextIO, Tuple, Type from . import pty_ as pty # avoid collisions with standard library `pty` from .asciicast import v2 from .asciicast.v2 import writer as w2 from .async_worker import async_worker def record( # pylint: disable=too-many-arguments,too-many-locals path_: str, command: Optional[str] = None, append: bool = False, idle_time_limit: Optional[float] = None, record_stdin: bool = False, title: Optional[str] = None, command_env: Optional[Dict[str, str]] = None, capture_env: Optional[List[str]] = None, writer: Type[w2] = v2.writer, record_: Callable[..., None] = pty.record, notify: Callable[[str], None] = lambda _: None, key_bindings: Optional[Dict[str, Any]] = None, cols_override: Optional[int] = None, rows_override: Optional[int] = None, ) -> None: if command is None: command = os.environ.get("SHELL", "sh") if command_env is None: command_env = os.environ.copy() if key_bindings is None: key_bindings = {} command_env["ASCIINEMA_REC"] = "1" if capture_env is None: capture_env = ["SHELL", "TERM"] time_offset: float = 0 if append and os.stat(path_).st_size > 0: time_offset = v2.get_duration(path_) with tty_fds() as (tty_stdin_fd, tty_stdout_fd), async_notifier( notify ) as _notifier: get_tty_size = _get_tty_size( tty_stdout_fd, cols_override, rows_override ) cols, rows = get_tty_size() metadata = build_metadata( cols, rows, idle_time_limit, capture_env, command_env, title ) sync_writer = writer( path_, metadata, append, on_error=_notifier.queue.put ) with async_writer(sync_writer, time_offset, record_stdin) as _writer: record_( ["sh", "-c", command], command_env, _writer, get_tty_size, _notifier.notify, key_bindings, tty_stdin_fd=tty_stdin_fd, tty_stdout_fd=tty_stdout_fd, ) class tty_fds: def __init__(self) -> None: self.stdin_file: Optional[TextIO] = None self.stdout_file: Optional[TextIO] = None def __enter__(self) -> Tuple[int, int]: try: self.stdout_file = open("/dev/tty", "wt", encoding="utf_8") except OSError: self.stdout_file = open("/dev/null", "wt", encoding="utf_8") return (sys.stdin.fileno(), self.stdout_file.fileno()) def __exit__(self, type_: str, value: str, traceback: str) -> None: assert self.stdout_file is not None self.stdout_file.close() def build_metadata( # pylint: disable=too-many-arguments cols: int, rows: int, idle_time_limit: Optional[float], capture_env: List[str], env: Dict[str, str], title: Optional[str], ) -> Dict[str, Any]: metadata: Dict[str, Any] = { "width": cols, "height": rows, "timestamp": int(time.time()), } if idle_time_limit is not None: metadata["idle_time_limit"] = idle_time_limit metadata["env"] = {var: env.get(var) for var in capture_env} if title: metadata["title"] = title return metadata class async_writer(async_worker): def __init__( self, writer: w2, time_offset: float, record_stdin: bool ) -> None: async_worker.__init__(self) self.writer = writer self.time_offset = time_offset self.record_stdin = record_stdin def write_stdin(self, ts: float, data: Any) -> None: if self.record_stdin: self.enqueue([ts, "i", data]) def write_stdout(self, ts: float, data: Any) -> None: self.enqueue([ts, "o", data]) def write_marker(self, ts: float) -> None: self.enqueue([ts, "m", None]) def write_resize(self, ts: float, size: Tuple[int, int]) -> None: self.enqueue([ts, "r", size]) def run(self) -> None: try: with self.writer as w: event: Tuple[float, str, Any] for event in iter(self.queue.get, None): assert event is not None ts, etype, data = event if etype == "o": w.write_stdout(self.time_offset + ts, data) elif etype == "i": w.write_stdin(self.time_offset + ts, data) elif etype == "m": w.write_marker(self.time_offset + ts) elif etype == "r": w.write_resize(self.time_offset + ts, data) except IOError: for event in iter(self.queue.get, None): pass class async_notifier(async_worker): def __init__(self, notify: Callable[[str], None]) -> None: async_worker.__init__(self) self._notify = notify def notify(self, text: str) -> None: self.enqueue(text) def perform(self, text: str) -> None: try: self._notify(text) except: # pylint: disable=bare-except # noqa: E722 # we catch *ALL* exceptions here because we don't want failed # notification to crash the recording session pass def _get_tty_size( fd: int, cols_override: Optional[int], rows_override: Optional[int] ) -> Callable[[], Tuple[int, int]]: if cols_override is not None and rows_override is not None: def fixed_size() -> Tuple[int, int]: return (cols_override, rows_override) # type: ignore return fixed_size if not os.isatty(fd): def fallback_size() -> Tuple[int, int]: return (cols_override or 80, rows_override or 24) return fallback_size def size() -> Tuple[int, int]: cols, rows = os.get_terminal_size(fd) return (cols_override or cols, rows_override or rows) return size �����������������������������������������������������������������������������������������������asciinema/tty_.py�����������������������������������������������������������������������������������0000664�0000000�0000000�00000001776�14515476772�0014375�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import os import select import termios as tty # avoid `Module "tty" has no attribute ...` errors from time import sleep from tty import setraw from typing import IO, Any, List, Optional, Union class raw: def __init__(self, fd: Union[IO[str], int]) -> None: self.fd = fd self.restore: bool = False self.mode: Optional[List[Any]] = None def __enter__(self) -> None: try: self.mode = tty.tcgetattr(self.fd) setraw(self.fd) self.restore = True except tty.error: # this is `termios.error` pass def __exit__(self, type_: str, value: str, traceback: str) -> None: if self.restore: sleep(0.01) # give the terminal time to send answerbacks assert isinstance(self.mode, list) tty.tcsetattr(self.fd, tty.TCSAFLUSH, self.mode) def read_blocking(fd: int, timeout: Any) -> bytes: if fd in select.select([fd], [], [], timeout)[0]: return os.read(fd, 1024) return b"" ��asciinema/urllib_http_adapter.py��������������������������������������������������������������������0000664�0000000�0000000�00000010175�14515476772�0017437�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import codecs import http import io import sys from base64 import b64encode from http.client import HTTPResponse from typing import Any, Dict, Generator, Optional, Tuple from urllib.error import HTTPError, URLError from urllib.request import Request, urlopen from uuid import uuid4 from .http_adapter import HTTPConnectionError class MultipartFormdataEncoder: def __init__(self) -> None: self.boundary = uuid4().hex self.content_type = f"multipart/form-data; boundary={self.boundary}" @classmethod def u(cls, s: Any) -> Any: if sys.hexversion >= 0x03000000 and isinstance(s, bytes): s = s.decode("utf-8") return s def iter( self, fields: Dict[str, Any], files: Dict[str, Tuple[str, Any]] ) -> Generator[Tuple[bytes, int], None, None]: """ fields: {name: value} for regular form fields. files: {name: (filename, file-type)} for data to be uploaded as files yield body's chunk as bytes """ encoder = codecs.getencoder("utf-8") for key, value in fields.items(): key = self.u(key) yield encoder(f"--{self.boundary}\r\n") yield encoder( self.u(f'content-disposition: form-data; name="{key}"\r\n') ) yield encoder("\r\n") if isinstance(value, (int, float)): value = str(value) yield encoder(self.u(value)) yield encoder("\r\n") for key, filename_and_f in files.items(): filename, f = filename_and_f key = self.u(key) filename = self.u(filename) yield encoder(f"--{self.boundary}\r\n") yield encoder( self.u( "content-disposition: form-data" f'; name="{key}"' f'; filename="{filename}"\r\n' ) ) yield encoder("content-type: application/octet-stream\r\n") yield encoder("\r\n") data = f.read() yield (data, len(data)) yield encoder("\r\n") yield encoder(f"--{self.boundary}--\r\n") def encode( self, fields: Dict[str, Any], files: Dict[str, Tuple[str, Any]] ) -> Tuple[str, bytes]: body = io.BytesIO() for chunk, _ in self.iter(fields, files): body.write(chunk) return self.content_type, body.getvalue() class URLLibHttpAdapter: # pylint: disable=too-few-public-methods def post( # pylint: disable=too-many-arguments,too-many-locals self, url: str, fields: Optional[Dict[str, Any]] = None, files: Optional[Dict[str, Tuple[str, Any]]] = None, headers: Optional[Dict[str, str]] = None, username: Optional[str] = None, password: Optional[str] = None, ) -> Tuple[Any, Optional[Dict[str, str]], bytes]: # avoid dangerous mutable default arguments if fields is None: fields = {} if files is None: files = {} if headers is None: headers = {} content_type, body = MultipartFormdataEncoder().encode(fields, files) headers = headers.copy() headers["content-type"] = content_type if password: encoded_auth = b64encode( f"{username}:{password}".encode("utf_8") ).decode("utf_8") headers["authorization"] = f"Basic {encoded_auth}" request = Request(url, data=body, headers=headers, method="POST") try: with urlopen(request) as response: status = response.status headers = self._parse_headers(response) body = response.read().decode("utf-8") except HTTPError as e: status = e.code headers = {} body = e.read() except (http.client.RemoteDisconnected, URLError) as e: raise HTTPConnectionError(str(e)) from e return (status, headers, body) @staticmethod def _parse_headers(response: HTTPResponse) -> Dict[str, str]: headers = {k.lower(): v for k, v in response.getheaders()} return headers ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������doc/������������������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0011645�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������doc/asciicast-v1.md���������������������������������������������������������������������������������0000664�0000000�0000000�00000004070�14515476772�0014457�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# asciicast file format (version 1) asciicast file is JSON file containing meta-data like duration or title of the recording, and the actual content printed to terminal's stdout during recording. Version 1 of the format was used by the asciinema recorder versions 1.0 up to 1.4. ## Attributes Every asciicast includes the following set of attributes: * `version` - set to 1, * `width` - terminal width (number of columns), * `height` - terminal height (number of rows), * `duration` - total duration of asciicast as floating point number, * `command` - command that was recorded, as given via `-c` option to `rec`, * `title` - title of the asciicast, as given via `-t` option to `rec`, * `env` - map of environment variables useful for debugging playback problems, * `stdout` - array of "frames", see below. ### Frame Frame represents an event of printing new data to terminal's stdout. It is a 2 element array containing **delay** and **data**. **Delay** is the number of seconds that elapsed since the previous frame (or since the beginning of the recording in case of the 1st frame) represented as a floating point number, with microsecond precision. **Data** is a string containing the data that was printed to a terminal in a given frame. It has to be valid, UTF-8 encoded JSON string as described in [JSON RFC section 2.5](http://www.ietf.org/rfc/rfc4627.txt), with all non-printable Unicode codepoints encoded as `\uXXXX`. For example, frame `[5.4321, "foo\rbar\u0007..."]` means there was 5 seconds of inactivity between previous printing and printing of `foo\rbar\u0007...`. ## Example asciicast A very short asciicast may look like this: { "version": 1, "width": 80, "height": 24, "duration": 1.515658, "command": "/bin/zsh", "title": "", "env": { "TERM": "xterm-256color", "SHELL": "/bin/zsh" }, "stdout": [ [ 0.248848, "\u001b[1;31mHello \u001b[32mWorld!\u001b[0m\n" ], [ 1.001376, "I am \rThis is on the next line." ] ] } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������doc/asciicast-v2.md���������������������������������������������������������������������������������0000664�0000000�0000000�00000014475�14515476772�0014472�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# asciicast file format (version 2) asciicast v2 file is [newline-delimited JSON](http://jsonlines.org/) file where: * __first line__ contains header (initial terminal size, timestamp and other meta-data), encoded as JSON object, * __all following lines__ form an event stream, _each line_ representing a separate event, encoded as 3-element JSON array. Example file: ```json {"version": 2, "width": 80, "height": 24, "timestamp": 1504467315, "title": "Demo", "env": {"TERM": "xterm-256color", "SHELL": "/bin/zsh"}} [0.248848, "o", "\u001b[1;31mHello \u001b[32mWorld!\u001b[0m\n"] [1.001376, "o", "That was ok\rThis is better."] [1.500000, "m", ""] [2.143733, "o", "Now... "] [4.050000, "r", "80x24"] [6.541828, "o", "Bye!"] ``` Suggested file extension is `.cast`, suggested media type is `application/x-asciicast`. ## Header asciicast header is JSON-encoded object containing recording meta-data. ### Required header attributes: #### `version` Must be set to `2`. Integer. #### `width` Initial terminal width (number of columns). Integer. #### `height` Initial terminal height (number of rows). Integer. ### Optional header attributes: #### `timestamp` Unix timestamp of the beginning of the recording session. Integer. #### `duration` Duration of the whole recording in seconds (when it's known upfront). Float. #### `idle_time_limit` Idle time limit, as given via `-i` option to `asciinema rec`. Float. This should be used by an asciicast player to reduce all terminal inactivity (delays between frames) to maximum of `idle_time_limit` value. #### `command` Command that was recorded, as given via `-c` option to `asciinema rec`. String. #### `title` Title of the asciicast, as given via `-t` option to `asciinema rec`. String. #### `env` Map of captured environment variables. Object (String -> String). Example env: ```json "env": { "SHELL": "/bin/bash", "TERM": "xterm-256color" } ``` > Official asciinema recorder captures only `SHELL` and `TERM` by default. All > implementations of asciicast-compatible terminal recorder should not capture > any additional environment variables unless explicitly permitted by the user. #### `theme` Color theme of the recorded terminal. Object, with the following attributes: - `fg` - normal text color, - `bg` - normal background color, - `palette` - list of 8 or 16 colors, separated by colon character. All colors are in the CSS `#rrggbb` format. Example theme: ```json "theme": { "fg": "#d0d0d0", "bg": "#212121", "palette": "#151515:#ac4142:#7e8e50:#e5b567:#6c99bb:#9f4e85:#7dd6cf:#d0d0d0:#505050:#ac4142:#7e8e50:#e5b567:#6c99bb:#9f4e85:#7dd6cf:#f5f5f5" } ``` > A specific technique of obtaining the colors from a terminal (using xrdb, > requesting them from a terminal via special escape sequences etc) doesn't > matter as long as the recorder can save it in the above format. ## Event stream Each element of the event stream is a 3-tuple encoded as JSON array: [time, code, data] Where: * `time` (float) - indicates when the event happened, represented as the number of seconds since the beginning of the recording session, * `code` (string) - specifies type of event, one of: `"o"`, `"i"`, `"m"`, `"r"` * `data` (any) - event specific data, described separately for each event code. For example, let's look at the following line: [1.001376, "o", "Hello world"] It represents: * output (code `o`), * of text `Hello world`, * which happened `1.001376` sec after the start of the recording session. ### Supported event codes This section describes the event codes supported in asciicast v2 format. The list is open to extension, and new event codes may be added in both the current and future versions of the format. For example, we may add new event code for text overlay (subtitles display). A tool which interprets the event stream (web/cli player, post-processor) should ignore (or pass through) event codes it doesn't understand or doesn't care about. #### "o" - output, data written to a terminal Event of code `"o"` represents printing new data to a terminal. `data` is a string containing the data that was printed. It must be valid, UTF-8 encoded JSON string as described in [JSON RFC section 2.5](http://www.ietf.org/rfc/rfc4627.txt), with any non-printable Unicode codepoints encoded as `\uXXXX`. #### "i" - input, data read from a terminal Event of code `"i"` represents character typed in by the user, or more specifically, raw data sent from a terminal emulator to stdin of the recorded program (usually shell). `data` is a string containing captured ASCII character representing a key, or a control character like `"\r"` (enter), `"\u0001"` (ctrl-a), `"\u0003"` (ctrl-c), etc. Like with `"o"` event, it's UTF-8 encoded JSON string, with any non-printable Unicode codepoints encoded as `\uXXXX`. > Official asciinema recorder doesn't capture keyboard input by default. All > implementations of asciicast-compatible terminal recorder should not capture > it either unless explicitly requested by the user. #### "m" - marker Event of code `"m"` represents a marker. When marker is encountered in the event stream and "pause on markers" functionality of the player is enabled, the playback should pause, and wait for the user to resume. `data` can be used to annotate a marker. Annotations may be used to e.g. show a list of named "chapters". #### "r" - resize Event of code `"r"` represents terminal resize. Those are captured in response to `SIGWINCH` signal. `data` contains new terminal size (columns + rows) formatted as `"{COLS}x{ROWS}"`, e.g. `"80x24"`. ## Notes on compatibility Version 2 of asciicast file format solves several problems which couldn't be easily fixed in the old format: * minimal memory usage when recording and replaying arbitrarily long sessions - disk space is the only limit, * when the recording session is interrupted (computer crash, accidental close of terminal window) you don't lose the whole recording, * it's real-time streaming friendly. Due to file structure change (standard JSON => newline-delimited JSON) version 2 is not backwards compatible with version 1. Support for v2 has been added in: * [asciinema terminal recorder](https://github.com/asciinema/asciinema) - 2.0.0 * [asciinema web player](https://github.com/asciinema/asciinema-player) - 2.6.0 * [asciinema server](https://github.com/asciinema/asciinema-server) - v20171105 tag in git repository ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������man/������������������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0011653�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������man/Makefile����������������������������������������������������������������������������������������0000664�0000000�0000000�00000000304�14515476772�0013310�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������VERSION=`python3 -c "import asciinema; print(asciinema.__version__)"` asciinema.1: asciinema.1.md pandoc asciinema.1.md -s -t man -o asciinema.1 -V header:"Version $(VERSION), `date +%Y-%m-%d`" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������man/asciinema.1�������������������������������������������������������������������������������������0000664�0000000�0000000�00000025642�14515476772�0013677�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������.\" Automatically generated by Pandoc 2.18 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "ASCIINEMA" "1" "" "Version 2.0.1" "Version 2.1.0, 2022-05-07" .hy .SH NAME .PP \f[B]asciinema\f[R] - terminal session recorder .SH SYNOPSIS .PP \f[B]asciinema --version\f[R] .PD 0 .P .PD \f[B]asciinema\f[R] \f[I]command\f[R] [\f[I]options\f[R]] [\f[I]args\f[R]] .SH DESCRIPTION .PP asciinema lets you easily record terminal sessions, replay them in a terminal as well as in a web browser and share them on the web. asciinema is Free and Open Source Software licensed under the GNU General Public License v3. .SH COMMANDS .PP asciinema is composed of multiple commands, similar to \f[V]git\f[R], \f[V]apt-get\f[R] or \f[V]brew\f[R]. .PP When you run \f[B]asciinema\f[R] with no arguments a help message is displayed, listing all available commands with their options. .SS rec [\f[I]filename\f[R]] .PP Record terminal session. .PP By running \f[B]asciinema rec [filename]\f[R] you start a new recording session. The command (process) that is recorded can be specified with \f[B]-c\f[R] option (see below), and defaults to \f[B]$SHELL\f[R] which is what you want in most cases. .PP You can temporarily pause recording of terminal by pressing Ctrl+\[rs]. This is useful when you want to execute some commands during the recording session that should not be captured (e.g.\ pasting secrets). Resume by pressing Ctrl+\[rs] again. .PP Recording finishes when you exit the shell (hit Ctrl+D or type \f[V]exit\f[R]). If the recorded process is not a shell then recording finishes when the process exits. .PP If the \f[I]filename\f[R] argument is omitted then (after asking for confirmation) the resulting asciicast is uploaded to asciinema-server (https://github.com/asciinema/asciinema-server) (by default to asciinema.org), where it can be watched and shared. .PP If the \f[I]filename\f[R] argument is given then the resulting recording (called asciicast) is saved to a local file. It can later be replayed with \f[B]asciinema play <filename>\f[R] and/or uploaded to asciinema server with \f[B]asciinema upload <filename>\f[R]. .PP \f[B]ASCIINEMA_REC=1\f[R] is added to recorded process environment variables. This can be used by your shell\[cq]s config file (\f[V].bashrc\f[R], \f[V].zshrc\f[R]) to alter the prompt or play a sound when the shell is being recorded. .TP Available options: \ .RS .TP \f[V]--stdin\f[R] Enable stdin (keyboard) recording (see below) .TP \f[V]--append\f[R] Append to existing recording .TP \f[V]--raw\f[R] Save raw STDOUT output, without timing information or other metadata .TP \f[V]--overwrite\f[R] Overwrite the recording if it already exists .TP \f[V]-c, --command=<command>\f[R] Specify command to record, defaults to \f[B]$SHELL\f[R] .TP \f[V]-e, --env=<var-names>\f[R] List of environment variables to capture, defaults to \f[B]SHELL,TERM\f[R] .TP \f[V]-t, --title=<title>\f[R] Specify the title of the asciicast .TP \f[V]-i, --idle-time-limit=<sec>\f[R] Limit recorded terminal inactivity to max \f[V]<sec>\f[R] seconds .TP \f[V]--cols=<n>\f[R] Override terminal columns for recorded process .TP \f[V]--rows=<n>\f[R] Override terminal rows for recorded process .TP \f[V]-y, --yes\f[R] Answer \[lq]yes\[rq] to all prompts (e.g.\ upload confirmation) .TP \f[V]-q, --quiet\f[R] Be quiet, suppress all notices/warnings (implies \f[B]-y\f[R]) .RE .PP Stdin recording allows for capturing of all characters typed in by the user in the currently recorded shell. This may be used by a player (e.g. asciinema-player (https://github.com/asciinema/asciinema-player)) to display pressed keys. Because it\[cq]s basically a key-logging (scoped to a single shell instance), it\[cq]s disabled by default, and has to be explicitly enabled via \f[B]\[en]stdin\f[R] option. .SS play <\f[I]filename\f[R]> .PP Replay recorded asciicast in a terminal. .PP This command replays a given asciicast (as recorded by \f[B]rec\f[R] command) directly in your terminal. The asciicast can be read from a file or from \f[I]\f[VI]stdin\f[I]\f[R] (`-'): .PP Playing from a local file: .IP .nf \f[C] asciinema play /path/to/asciicast.cast \f[R] .fi .PP Playing from HTTP(S) URL: .IP .nf \f[C] asciinema play https://asciinema.org/a/22124.cast asciinema play http://example.com/demo.cast \f[R] .fi .PP Playing from asciicast page URL (requires \f[V]<link rel=\[dq]alternate\[dq] type=\[dq]application/x-asciicast\[dq] href=\[dq]/my/ascii.cast\[dq]>\f[R] in page\[cq]s HTML): .IP .nf \f[C] asciinema play https://asciinema.org/a/22124 asciinema play http://example.com/blog/post.html \f[R] .fi .PP Playing from stdin: .IP .nf \f[C] cat /path/to/asciicast.cast | asciinema play - ssh user\[at]host cat asciicast.cast | asciinema play - \f[R] .fi .PP Playing from IPFS: .IP .nf \f[C] asciinema play dweb:/ipfs/QmNe7FsYaHc9SaDEAEXbaagAzNw9cH7YbzN4xV7jV1MCzK/ascii.cast \f[R] .fi .TP Available options: \ .RS .TP \f[V]-i, --idle-time-limit=<sec>\f[R] Limit replayed terminal inactivity to max \f[V]<sec>\f[R] seconds (can be fractional) .TP \f[V]-s, --speed=<factor>\f[R] Playback speed (can be fractional) .RE .TP While playing the following keyboard shortcuts are available: \ .RS .TP \f[I]\f[VI]Space\f[I]\f[R] Toggle pause .TP \f[I]\f[VI].\f[I]\f[R] Step through a recording a frame at a time (when paused) .TP \f[I]\f[VI]Ctrl+C\f[I]\f[R] Exit .RE .PP Recommendation: run `asciinema play' in a terminal of dimensions not smaller than the one used for recording as there\[cq]s no \[lq]transcoding\[rq] of control sequences for the new terminal size. .SS cat <\f[I]filename\f[R]> .PP Print full output of recorded asciicast to a terminal. .PP While \f[B]asciinema play \f[R] replays the recorded session using timing information saved in the asciicast, \f[B]asciinema cat \f[R] dumps the full output (including all escape sequences) to a terminal immediately. .PP \f[B]asciinema cat existing.cast >output.txt\f[R] gives the same result as recording via \f[B]asciinema rec --raw output.txt\f[R]. .SS upload <\f[I]filename\f[R]> .PP Upload recorded asciicast to asciinema.org site. .PP This command uploads given asciicast (recorded by \f[B]rec\f[R] command) to asciinema.org, where it can be watched and shared. .PP \f[B]asciinema rec demo.cast\f[R] + \f[B]asciinema play demo.cast\f[R] + \f[B]asciinema upload demo.cast\f[R] is a nice combo if you want to review an asciicast before publishing it on asciinema.org. .SS auth .PP Link and manage your install ID with your asciinema.org user account. .PP If you want to manage your recordings (change title/theme, delete) at asciinema.org you need to link your \[lq]install ID\[rq] with your asciinema.org user account. .PP This command displays the URL to open in a web browser to do that. You may be asked to log in first. .PP Install ID is a random ID (UUID v4 (https://en.wikipedia.org/wiki/Universally_unique_identifier)) generated locally when you run asciinema for the first time, and saved at \f[B]$HOME/.config/asciinema/install-id\f[R]. It\[cq]s purpose is to connect local machine with uploaded recordings, so they can later be associated with asciinema.org account. This way we decouple uploading from account creation, allowing them to happen in any order. .PP Note: A new install ID is generated on each machine and system user account you use asciinema on. So in order to keep all recordings under a single asciinema.org account you need to run \f[B]asciinema auth\f[R] on all of those machines. If you\[cq]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. .PP While you CAN synchronize your config file (which keeps the API token) across all your machines so all use the same token, that\[cq]s not necessary. You can assign new tokens to your account from as many machines as you want. .PP Note: asciinema versions prior to 2.0 confusingly referred to install ID as \[lq]API token\[rq]. .SH EXAMPLES .PP Record your first session: .IP .nf \f[C] asciinema rec first.cast \f[R] .fi .PP End your session: .IP .nf \f[C] exit \f[R] .fi .PP Now replay it with double speed: .IP .nf \f[C] asciinema play -s 2 first.cast \f[R] .fi .PP Or with normal speed but with idle time limited to 2 seconds: .IP .nf \f[C] asciinema play -i 2 first.cast \f[R] .fi .PP You can pass \f[B]-i 2\f[R] to \f[B]asciinema rec\f[R] as well, to set it permanently on a recording. Idle time limiting makes the recordings much more interesting to watch, try it. .PP If you want to watch and share it on the web, upload it: .IP .nf \f[C] asciinema upload first.cast \f[R] .fi .PP The above uploads it to <https://asciinema.org>, which is a default asciinema-server (<https://github.com/asciinema/asciinema-server>) instance, and prints a secret link you can use to watch your recording in a web browser. .PP You can record and upload in one step by omitting the filename: .IP .nf \f[C] asciinema rec \f[R] .fi .PP You\[cq]ll be asked to confirm the upload when the recording is done, so nothing is sent anywhere without your consent. .SS Tricks .TP Record slowly, play faster: First record a session where you can take your time to type slowly what you want to show in the recording: .RS .IP .nf \f[C] asciinema rec initial.cast \f[R] .fi .PP Then record the replay of `initial.cast' as `final.cast', but with five times the initially recorded speed, with all pauses capped to two seconds and with a title set as \[lq]My fancy title\[rq]:: .IP .nf \f[C] asciinema rec -c \[dq]asciinema play -s 5 -i 2 initial.cast\[dq] -t \[dq]My fancy title\[dq] final.cast \f[R] .fi .RE .TP Play from \f[I]\f[VI]stdin\f[I]\f[R]: \ .RS .PP cat /path/to/asciicast.json | asciinema play - .RE .TP Play file from remote host accessible with SSH: \ .RS .PP ssh user\[at]host cat /path/to/asciicat.json | asciinema play - .RE .SH ENVIRONMENT .TP \f[B]ASCIINEMA_API_URL\f[R] This variable allows overriding asciinema-server URL (which defaults to https://asciinema.org) in case you\[cq]re running your own asciinema-server instance. .TP \f[B]ASCIINEMA_CONFIG_HOME\f[R] This variable allows overriding config directory location. Default location is $XDG_CONFIG_HOME/asciinema (when $XDG_CONFIG_HOME is set) or $HOME/.config/asciinema. .SH BUGS .PP See GitHub Issues: <https://github.com/asciinema/asciinema/issues> .SH MORE RESOURCES .PP More documentation is available on the asciicast.org website and its GitHub wiki: .IP \[bu] 2 Web: asciinema.org/docs/ (https://asciinema.org/docs/) .IP \[bu] 2 Wiki: github.com/asciinema/asciinema/wiki (https://github.com/asciinema/asciinema/wiki) .IP \[bu] 2 IRC: Channel on Libera.Chat (https://web.libera.chat/gamja/#asciinema) .IP \[bu] 2 Twitter: \[at]asciinema (https://twitter.com/asciinema) .SH AUTHORS .PP asciinema\[cq]s lead developer is Marcin Kulik. .PP For a list of all contributors look here: <https://github.com/asciinema/asciinema/contributors> .PP This Manual Page was written by Marcin Kulik with help from Kurt Pfeifle. ����������������������������������������������������������������������������������������������man/asciinema.1.md����������������������������������������������������������������������������������0000664�0000000�0000000�00000024015�14515476772�0014267�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������% ASCIINEMA(1) Version 2.0.1 | asciinema NAME ==== **asciinema** - terminal session recorder SYNOPSIS ======== | **asciinema \-\-version** | **asciinema** _command_ \[_options_] \[_args_] DESCRIPTION =========== asciinema lets you easily record terminal sessions, replay them in a terminal as well as in a web browser and share them on the web. asciinema is Free and Open Source Software licensed under the GNU General Public License v3. COMMANDS ======== asciinema is composed of multiple commands, similar to `git`, `apt-get` or `brew`. When you run **asciinema** with no arguments a help message is displayed, listing all available commands with their options. rec [_filename_] --- Record terminal session. 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. You can temporarily pause the capture of your terminal by pressing <kbd>Ctrl+\\</kbd>. This is useful when you want to execute some commands during the recording session that should not be captured (e.g. pasting secrets). Resume by pressing <kbd>Ctrl+\\</kbd> again. When pausing desktop notification is displayed so you're sure the sensitive output won't be captured in the recording. Recording finishes when you exit the shell (hit <kbd>Ctrl+D</kbd> or type `exit`). If the recorded process is not a shell then recording finishes when the process exits. If the _filename_ argument is omitted then (after asking for confirmation) the resulting asciicast is uploaded to [asciinema-server](https://github.com/asciinema/asciinema-server) (by default to asciinema.org), where it can be watched and shared. If the _filename_ argument is given then the resulting recording (called [asciicast](doc/asciicast-v2.md)) is saved to a local file. It can later be replayed with **asciinema play \<filename>** and/or uploaded to asciinema server with **asciinema upload \<filename>**. **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 the shell is being recorded. Available options: :   `--stdin` : Enable stdin (keyboard) recording (see below) `--append` : Append to existing recording `--raw` : Save raw STDOUT output, without timing information or other metadata `--overwrite` : Overwrite the recording if it already exists `-c, --command=<command>` : Specify command to record, defaults to **$SHELL** `-e, --env=<var-names>` : List of environment variables to capture, defaults to **SHELL,TERM** `-t, --title=<title>` : Specify the title of the asciicast `-i, --idle-time-limit=<sec>` : Limit recorded terminal inactivity to max `<sec>` seconds `--cols=<n>` : Override terminal columns for recorded process `--rows=<n>` : Override terminal rows for recorded process `-y, --yes` : Answer "yes" to all prompts (e.g. upload confirmation) `-q, --quiet` : Be quiet, suppress all notices/warnings (implies **-y**) Stdin recording allows for capturing of all characters typed in by the user in the currently recorded shell. This may be used by a player (e.g. [asciinema-player](https://github.com/asciinema/asciinema-player)) to display pressed keys. Because it's basically a key-logging (scoped to a single shell instance), it's disabled by default, and has to be explicitly enabled via **--stdin** option. play <_filename_> --- Replay recorded asciicast in a terminal. This command replays a given asciicast (as recorded by **rec** command) directly in your terminal. The asciicast can be read from a file or from *`stdin`* ('-'): Playing from a local file: asciinema play /path/to/asciicast.cast Playing from HTTP(S) URL: asciinema play https://asciinema.org/a/22124.cast asciinema play http://example.com/demo.cast Playing from asciicast page URL (requires `<link rel="alternate" type="application/x-asciicast" href="/my/ascii.cast">` 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.cast | asciinema play - ssh user@host cat asciicast.cast | asciinema play - Playing from IPFS: asciinema play dweb:/ipfs/QmNe7FsYaHc9SaDEAEXbaagAzNw9cH7YbzN4xV7jV1MCzK/ascii.cast Available options: :   `-i, --idle-time-limit=<sec>` : Limit replayed terminal inactivity to max `<sec>` seconds (can be fractional) `-s, --speed=<factor>` : Playback speed (can be fractional) While playing the following keyboard shortcuts are available: :   *`Space`* : Toggle pause *`.`* : Step through a recording a frame at a time (when paused) *`Ctrl+C`* : Exit Recommendation: 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 the new terminal size. cat <_filename_> --- Print full output of recorded asciicast to a terminal. While **asciinema play <filename>** replays the recorded session using timing information saved in the asciicast, **asciinema cat <filename>** dumps the full output (including all escape sequences) to a terminal immediately. **asciinema cat existing.cast >output.txt** gives the same result as recording via **asciinema rec \-\-raw output.txt**. upload <_filename_> ------ Upload recorded asciicast to asciinema.org site. This command uploads given asciicast (recorded by **rec** command) to asciinema.org, where it can be watched and shared. **asciinema rec demo.cast** + **asciinema play demo.cast** + **asciinema upload demo.cast** is a nice combo if you want to review an asciicast before publishing it on asciinema.org. auth ---- Link and manage your install ID with your asciinema.org user account. If you want to manage your recordings (change title/theme, delete) at asciinema.org you need to link your "install ID" with your asciinema.org user account. This command displays the URL to open in a web browser to do that. You may be asked to log in first. Install ID is a random ID ([UUID v4](https://en.wikipedia.org/wiki/Universally_unique_identifier)) generated locally when you run asciinema for the first time, and saved at **$HOME/.config/asciinema/install-id**. It's purpose is to connect local machine with uploaded recordings, so they can later be associated with asciinema.org account. This way we decouple uploading from account creation, allowing them to happen in any order. Note: A new install ID is generated on each machine and system user account you use asciinema on. So in order to keep all recordings under a single asciinema.org account you need to run **asciinema auth** on all of those machines. 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. While you CAN synchronize your config file (which keeps the API token) across all your machines so all use the same token, that’s not necessary. You can assign new tokens to your account from as many machines as you want. Note: asciinema versions prior to 2.0 confusingly referred to install ID as "API token". EXAMPLES ======== Record your first session: asciinema rec first.cast End your session: exit Now replay it with double speed: asciinema play -s 2 first.cast Or with normal speed but with idle time limited to 2 seconds: asciinema play -i 2 first.cast You can pass **-i 2** to **asciinema rec** as well, to set it permanently on a recording. Idle time limiting makes the recordings much more interesting to watch, try it. If you want to watch and share it on the web, upload it: asciinema upload first.cast The above uploads it to <https://asciinema.org>, which is a default asciinema-server (<https://github.com/asciinema/asciinema-server>) instance, and prints a secret link you can use to watch your recording in a web browser. You can record and upload in one step by omitting the filename: asciinema rec You'll be asked to confirm the upload when the recording is done, so nothing is sent anywhere without your consent. Tricks ------ Record slowly, play faster: : First record a session where you can take your time to type slowly what you want to show in the recording: asciinema rec initial.cast Then record the replay of 'initial.cast' as 'final.cast', but with five times the initially recorded speed, with all pauses capped to two seconds and with a title set as "My fancy title":: asciinema rec -c "asciinema play -s 5 -i 2 initial.cast" -t "My fancy title" final.cast Play from *`stdin`*: :   cat /path/to/asciicast.json | asciinema play - Play file from remote host accessible with SSH: :   ssh user@host cat /path/to/asciicat.json | asciinema play - ENVIRONMENT =========== **ASCIINEMA_API_URL** : This variable allows overriding asciinema-server URL (which defaults to https://asciinema.org) in case you're running your own asciinema-server instance. **ASCIINEMA_CONFIG_HOME** : This variable allows overriding config directory location. Default location is $XDG\_CONFIG\_HOME/asciinema (when $XDG\_CONFIG\_HOME is set) or $HOME/.config/asciinema. BUGS ==== See GitHub Issues: <https://github.com/asciinema/asciinema/issues> MORE RESOURCES =============== More documentation is available on the asciicast.org website and its GitHub wiki: * Web: [asciinema.org/docs/](https://asciinema.org/docs/) * Wiki: [github.com/asciinema/asciinema/wiki](https://github.com/asciinema/asciinema/wiki) * IRC: [Channel on Libera.Chat](https://web.libera.chat/gamja/#asciinema) * Twitter: [@asciinema](https://twitter.com/asciinema) AUTHORS ======= asciinema's lead developer is Marcin Kulik. For a list of all contributors look here: <https://github.com/asciinema/asciinema/contributors> This Manual Page was written by Marcin Kulik with help from Kurt Pfeifle. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pyproject.toml��������������������������������������������������������������������������������������0000664�0000000�0000000�00000001502�14515476772�0014012�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������[build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [tool.black] line-length = 79 target-version = ["py38"] [tool.isort] line_length = 79 profile = "black" multi_line_output = 3 [tool.mypy] check_untyped_defs = true disallow_any_generics = true disallow_incomplete_defs = true disallow_subclassing_any = true disallow_untyped_calls = true disallow_untyped_decorators = true disallow_untyped_defs = true no_implicit_optional = true no_implicit_reexport = true show_error_context = true warn_redundant_casts = true warn_return_any = true warn_unused_configs = true warn_unused_ignores = true exclude = [] [tool.pylint."MESSAGES CONTROL"] disable = [ "invalid-name", "missing-class-docstring", "missing-function-docstring", "missing-module-docstring", ] min-similarity-lines = 7 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������setup.cfg�������������������������������������������������������������������������������������������0000664�0000000�0000000�00000002762�14515476772�0012730�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������[metadata] name = asciinema version = 2.4.0 author = Marcin Kulik author_email = m@ku1ik.com url = https://asciinema.org download_url = https://github.com/asciinema/asciinema/archive/v%(version)s.tar.gz description = Terminal session recorder description_file = README.md license = GNU GPLv3 license_file = LICENSE long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8 classifiers = Development Status :: 5 - Production/Stable Environment :: Console Intended Audience :: Developers Intended Audience :: System Administrators License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Natural Language :: English Programming Language :: Python Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Topic :: System :: Shells Topic :: Terminals Topic :: Utilities [options] include_package_data = True packages = asciinema asciinema.asciicast asciinema.commands install_requires = [options.package_data] asciinema = data/*.png [options.entry_points] console_scripts = asciinema = asciinema.__main__:main [options.data_files] share/doc/asciinema = CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md README.md doc/asciicast-v1.md doc/asciicast-v2.md share/man/man1 = man/asciinema.1 [pycodestyle] ignore = E501,E402,E722 ��������������tests/����������������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0012242�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/__init__.py�����������������������������������������������������������������������������������0000664�0000000�0000000�00000000000�14515476772�0014341�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/asciicast/������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0014205�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/asciicast/__init__.py�������������������������������������������������������������������������0000664�0000000�0000000�00000000000�14515476772�0016304�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/asciicast/v2_test.py��������������������������������������������������������������������������0000664�0000000�0000000�00000001611�14515476772�0016144�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import json import tempfile from asciinema.asciicast import v2 from ..test_helper import Test class TestWriter(Test): @staticmethod def test_writing() -> None: _file, path = tempfile.mkstemp() with v2.writer(path, width=80, height=24) as w: w.write_stdout(1, "x") # ensure it supports both str and bytes w.write_stdout(2, bytes.fromhex("78 c5 bc c3 b3 c5")) w.write_stdout(3, bytes.fromhex("82 c4 87")) w.write_stdout(4, bytes.fromhex("78 78")) with open(path, "rt", encoding="utf_8") as f: lines = list(map(json.loads, f.read().strip().split("\n"))) assert lines == [ {"version": 2, "width": 80, "height": 24}, [1, "o", "x"], [2, "o", "xżó"], [3, "o", "łć"], [4, "o", "xx"], ], f"got:\n\n{lines}" �����������������������������������������������������������������������������������������������������������������������tests/config_test.py��������������������������������������������������������������������������������0000664�0000000�0000000�00000013657�14515476772�0015134�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import re import tempfile from os import path from typing import Dict, Optional import asciinema.config as cfg from asciinema.config import Config def create_config( content: Optional[str] = None, env: Optional[Dict[str, str]] = None ) -> Config: # avoid redefining `dir` builtin dir_ = tempfile.mkdtemp() if content: # avoid redefining `os.path` path_ = f"{dir_}/config" with open(path_, "wt", encoding="utf_8") as f: f.write(content) return cfg.Config(dir_, env) def read_install_id(install_id_path: str) -> str: with open(install_id_path, "rt", encoding="utf_8") as f: return f.read().strip() def test_upgrade_no_config_file() -> None: config = create_config() config.upgrade() install_id = read_install_id(config.install_id_path) assert re.match("^\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}", install_id) assert install_id == config.install_id assert not path.exists(config.config_file_path) # it must not change after another upgrade config.upgrade() assert read_install_id(config.install_id_path) == install_id def test_upgrade_config_file_with_api_token() -> None: config = create_config("[api]\ntoken = foo-bar-baz") config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" assert config.install_id == "foo-bar-baz" assert not path.exists(config.config_file_path) config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" def test_upgrade_config_file_with_api_token_and_more() -> None: config = create_config( "[api]\ntoken = foo-bar-baz\nurl = http://example.com" ) config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" assert config.install_id == "foo-bar-baz" assert config.api_url == "http://example.com" assert path.exists(config.config_file_path) config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" def test_upgrade_config_file_with_user_token() -> None: config = create_config("[user]\ntoken = foo-bar-baz") config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" assert config.install_id == "foo-bar-baz" assert not path.exists(config.config_file_path) config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" def test_upgrade_config_file_with_user_token_and_more() -> None: config = create_config( "[user]\ntoken = foo-bar-baz\n[api]\nurl = http://example.com" ) config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" assert config.install_id == "foo-bar-baz" assert config.api_url == "http://example.com" assert path.exists(config.config_file_path) config.upgrade() assert read_install_id(config.install_id_path) == "foo-bar-baz" def test_default_api_url() -> None: config = create_config("") assert config.api_url == "https://asciinema.org" def test_default_record_stdin() -> None: config = create_config("") assert config.record_stdin is False def test_default_record_command() -> None: config = create_config("") assert config.record_command is None def test_default_record_env() -> None: config = create_config("") assert config.record_env == "SHELL,TERM" def test_default_record_idle_time_limit() -> None: config = create_config("") assert config.record_idle_time_limit is None def test_default_record_yes() -> None: config = create_config("") assert config.record_yes is False def test_default_record_quiet() -> None: config = create_config("") assert config.record_quiet is False def test_default_play_idle_time_limit() -> None: config = create_config("") assert config.play_idle_time_limit is None def test_api_url() -> None: config = create_config("[api]\nurl = http://the/url") assert config.api_url == "http://the/url" def test_api_url_when_override_set() -> None: config = create_config( "[api]\nurl = http://the/url", {"ASCIINEMA_API_URL": "http://the/url2"} ) assert config.api_url == "http://the/url2" def test_record_command() -> None: command = "bash -l" config = create_config(f"[record]\ncommand = {command}") assert config.record_command == command def test_record_stdin() -> None: config = create_config("[record]\nstdin = yes") assert config.record_stdin is True def test_record_env() -> None: config = create_config("[record]\nenv = FOO,BAR") assert config.record_env == "FOO,BAR" def test_record_idle_time_limit() -> None: config = create_config("[record]\nidle_time_limit = 2.35") assert config.record_idle_time_limit == 2.35 config = create_config("[record]\nmaxwait = 2.35") assert config.record_idle_time_limit == 2.35 def test_record_yes() -> None: yes = "yes" config = create_config(f"[record]\nyes = {yes}") assert config.record_yes is True def test_record_quiet() -> None: quiet = "yes" config = create_config(f"[record]\nquiet = {quiet}") assert config.record_quiet is True def test_play_idle_time_limit() -> None: config = create_config("[play]\nidle_time_limit = 2.35") assert config.play_idle_time_limit == 2.35 config = create_config("[play]\nmaxwait = 2.35") assert config.play_idle_time_limit == 2.35 def test_notifications_enabled() -> None: config = create_config("") assert config.notifications_enabled is True config = create_config("[notifications]\nenabled = yes") assert config.notifications_enabled is True config = create_config("[notifications]\nenabled = no") assert config.notifications_enabled is False def test_notifications_command() -> None: config = create_config("") assert config.notifications_command is None config = create_config( '[notifications]\ncommand = tmux display-message "$TEXT"' ) assert config.notifications_command == 'tmux display-message "$TEXT"' ���������������������������������������������������������������������������������tests/demo.cast�������������������������������������������������������������������������������������0000664�0000000�0000000�00000012076�14515476772�0014050�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{"env": {"TERM": "xterm-256color", "SHELL": "/usr/local/bin/fish"}, "width": 75, "height": 18, "timestamp": 1509091818, "version": 2, "idle_time_limit": 2.0} [0.089436, "o", "\u001b]0;fish /Users/sickill/code/asciinema/asciinema\u0007\u001b[30m\u001b(B\u001b[m"] [0.100989, "o", "\u001b[?2004h"] [0.164215, "o", "\u001b]0;fish /Users/sickill/code/asciinema/asciinema\u0007\u001b[30m\u001b(B\u001b[m"] [0.164513, "o", "\u001b[38;5;237m⏎\u001b(B\u001b[m \r⏎ \r\u001b[2K"] [0.164709, "o", "\u001b[32m~/c/a/asciinema\u001b[30m\u001b(B\u001b[m (develop ↩☡=) \u001b[30m\u001b(B\u001b[m\u001b[K"] [1.511526, "i", "v"] [1.511937, "o", "v"] [1.512148, "o", "\b\u001b[38;2;0;95;215mv\u001b[30m\u001b(B\u001b[m"] [1.514564, "o", "\u001b[38;2;85;85;85mim tests/vim.cast \u001b[18D\u001b[30m\u001b(B\u001b[m"] [1.615727, "i", "i"] [1.616261, "o", "\u001b[38;2;0;95;215mi\u001b[38;2;85;85;85mm tests/vim.cast \u001b[17D\u001b[30m\u001b(B\u001b[m"] [1.694908, "i", "m"] [1.695262, "o", "\u001b[38;2;0;95;215mm\u001b[38;2;85;85;85m tests/vim.cast \u001b[16D\u001b[30m\u001b(B\u001b[m"] [2.751713, "i", "\r"] [2.752186, "o", "\u001b[K\r\n\u001b[30m"] [2.752381, "o", "\u001b(B\u001b[m\u001b[?2004l"] [2.752718, "o", "\u001b]0;vim /Users/sickill/code/asciinema/asciinema\u0007\u001b[30m\u001b(B\u001b[m\r"] [2.86619, "o", "\u001b[?1000h\u001b[?2004h\u001b[?1049h\u001b[?1h\u001b=\u001b[?2004h"] [2.867669, "o", "\u001b[1;18r\u001b[?12h\u001b[?12l\u001b[27m\u001b[29m\u001b[m\u001b[38;5;231m\u001b[48;5;235m\u001b[H\u001b[2J\u001b[2;1H▽\u001b[6n\u001b[2;1H \u001b[1;1H\u001b[>c"] [2.868169, "i", "\u001b[2;2R\u001b[>0;95;0c"] [2.869918, "o", "\u001b[?1000l\u001b[?1002h\u001b[?12$p"] [2.870136, "o", "\u001b[?25l\u001b[1;1H\u001b[93m1 \u001b[m\u001b[38;5;231m\u001b[48;5;235m\r\n\u001b[38;5;59m\u001b[48;5;236m~ \u001b[3;1H~ \u001b[4;1H~ \u001b[5;1H~ \u001b[6;1H~ \u001b[7;1H~ \u001b[8;1H~ \u001b[9;1H~ \u001b[10;1H~ \u001b[11;1H~ \u001b[12;1H~ \u001b[13;1H~ "] [2.870245, "o", " \u001b[14;1H~ \u001b[15;1H~ \u001b[16;1H~ \u001b[m\u001b[38;5;231m\u001b[48;5;235m\u001b[17;1H\u001b[1m\u001b[38;5;231m\u001b[48;5;236m[No Name] (unix/utf-8/) (line 0/1, col 000)\u001b[m\u001b[38;5;231m\u001b[48;5;235m\u001b[3;30HVIM - Vi IMproved\u001b[5;30Hversion 8.0.1171\u001b[6;26Hby Bram Moolenaar et al.\u001b[7;17HVim is open source and freely distributable\u001b[9;24HBecome a registered Vim user!\u001b[10;15Htype :help register\u001b[38;5;59m\u001b[48;5;236m<Enter>\u001b[m\u001b[38;5;231m\u001b[48;5;235m for information \u001b[12;15Htype :q\u001b[38;5;59m\u001b[48;5;236m<Enter>\u001b[m\u001b[38;5;231m\u001b[48;5;235m to exit \u001b[13;15Htype :help\u001b[38;5;59m\u001b[48;5;236m<Enter>\u001b[m\u001b[38;5;231m\u001b[48;5;235m or \u001b[38;5;59m\u001b[48;5;236m<F1>\u001b[m\u001b[38;5;231m\u001b[48;5;235m for on-line help\u001b[14;15Htype :help version8\u001b[38;5;59m\u001b[48;5;236m<Enter>\u001b[m\u001b[38;5;231m\u001b[48;5;235m for version"] [2.870302, "o", " info\u001b[1;5H\u001b[?25h"] [5.63147, "i", ":"] [5.631755, "o", "\u001b[?25l\u001b[18;65H:\u001b[1;5H"] [5.631934, "o", "\u001b[18;65H\u001b[K\u001b[18;1H:\u001b[?2004l\u001b[?2004h\u001b[?25h"] [6.16692, "i", "q"] [6.167137, "o", "q\u001b[?25l\u001b[?25h"] [7.463349, "i", "\r"] [7.463561, "o", "\r"] [7.498922, "o", "\u001b[?25l\u001b[?1002l\u001b[?2004l"] [7.604236, "o", "\u001b[18;1H\u001b[K\u001b[18;1H\u001b[?2004l\u001b[?1l\u001b>\u001b[?25h\u001b[?1049l"] [7.612576, "o", "\u001b[?2004h"] [7.655999, "o", "\u001b]0;fish /Users/sickill/code/asciinema/asciinema\u0007\u001b[30m\u001b(B\u001b[m"] [7.656239, "o", "\u001b[38;5;237m⏎\u001b(B\u001b[m \r⏎ \r\u001b[2K\u001b[32m~/c/a/asciinema\u001b[30m\u001b(B\u001b[m (develop ↩☡=) \u001b[30m\u001b(B\u001b[m\u001b[K"] [11.891762, "i", "\u0004"] [11.893297, "o", "\r\n\u001b[30m\u001b(B\u001b[m\u001b[30m\u001b(B\u001b[m"] [11.89348, "o", "\u001b[?2004l"] ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/demo.json�������������������������������������������������������������������������������������0000664�0000000�0000000�00000013013�14515476772�0014057�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ "version": 1, "width": 80, "height": 40, "duration": 6.46111, "command": "/bin/bash", "title": null, "env": { "TERM": "xterm-256color", "SHELL": "/bin/bash" }, "stdout": [ [ 0.013659, "\u001b[?1034hbash-3.2$ " ], [ 1.923187, "v" ], [ 0.064049, "i" ], [ 0.032034, "m" ], [ 0.19157, "\r\n" ], [ 0.032342, "\u001b[?1049h\u001b[?1h\u001b=\u001b[2;1H▽\u001b[6n\u001b[2;1H \u001b[1;1H" ], [ 0.001436, "\u001b[1;40r\u001b[?12;25h\u001b[?12l\u001b[?25h\u001b[27m\u001b[m\u001b[H\u001b[2J\u001b[>c" ], [ 0.000311, "\u001b[?25l\u001b[1;1H\u001b[33m 1 \u001b[m\r\n\u001b[1m\u001b[34m~ \u001b[3;1H~ \u001b[4;1H~ \u001b[5;1H~ \u001b[6;1H~ \u001b[7;1H~ \u001b[8;1H~ \u001b[9;1H~ \u001b[10;1H~ \u001b[11;1H~ \u001b[12;1H~ \u001b[13;1H~ " ], [ 3.9e-05, " \u001b[14;1H~ \u001b[15;1H~ \u001b[16;1H~ \u001b[17;1H~ \u001b[18;1H~ \u001b[19;1H~ \u001b[20;1H~ \u001b[21;1H~ \u001b[22;1H~ \u001b[23;1H~ \u001b[24;1H~ \u001b[25;1H~ " ], [ 9.2e-05, " \u001b[26;1H~ \u001b[27;1H~ \u001b[28;1H~ \u001b[29;1H~ \u001b[30;1H~ \u001b[31;1H~ \u001b[32;1H~ \u001b[33;1H~ \u001b[34;1H~ \u001b[35;1H~ \u001b[36;1H~ \u001b[37;" ], [ 2.4e-05, "1H~ \u001b[38;1H~ \u001b[m\u001b[39;1H\u001b[1m\u001b[7m[No Name] \u001b[m\u001b[14;32HVIM - Vi IMproved\u001b[16;33Hversion 7.4.8056\u001b[17;29Hby Bram Moolenaar et al.\u001b[18;19HVim is open source and freely distributable\u001b[20;26HBecome a registered Vim user!\u001b[21;18Htype :help register\u001b[32m<Enter>\u001b[m for information \u001b[23;18Htype :q\u001b[32m<Enter>\u001b[m to exit \u001b[24;18Htype :help\u001b[32m<Enter>\u001b[m or \u001b[32m<F1>\u001b[m for on-line help\u001b[25;18Htype :help version7\u001b[32m<Enter>\u001b[m for version info\u001b[1;5H\u001b[?12l\u001b[?25h" ], [ 1.070242, "\u001b[?25l\u001b[40;1H:" ], [ 2.3e-05, "\u001b[?12l\u001b[?25h" ], [ 0.503964, "q" ], [ 0.151903, "u" ], [ 0.04002, "i" ], [ 0.088084, "t" ], [ 0.287636, "\r" ], [ 0.002178, "\u001b[?25l\u001b[40;1H\u001b[K\u001b[40;1H\u001b[?1l\u001b>\u001b[?12l\u001b[?25h\u001b[?1049l" ], [ 0.000999, "bash-3.2$ " ], [ 1.58912, "e" ], [ 0.184114, "x" ], [ 0.087915, "i" ], [ 0.103987, "t" ], [ 0.087613, "\r\n" ] ] } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/distros.sh������������������������������������������������������������������������������������0000775�0000000�0000000�00000001250�14515476772�0014266�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env bash set -euo pipefail readonly DISTROS=( 'arch' 'alpine' 'centos' 'debian' 'fedora' 'ubuntu' ) readonly DOCKER='docker' # do not redefine builtin `test` test_() { local -r tag="${1}" local -ra docker_opts=( "--tag=asciinema/asciinema:${tag}" "--file=tests/distros/Dockerfile.${tag}" ) printf "\e[1;32mTesting on %s...\e[0m\n\n" "${tag}" # shellcheck disable=SC2068 "${DOCKER}" build ${docker_opts[@]} . "${DOCKER}" run --rm -it "asciinema/asciinema:${tag}" tests/integration.sh } for distro in "${DISTROS[@]}"; do test_ "${distro}" done printf "\n\e[1;32mAll tests passed.\e[0m\n" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/distros/��������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�14515476772�0013731�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/distros/Dockerfile.alpine���������������������������������������������������������������������0000664�0000000�0000000�00000000517�14515476772�0017175�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# syntax=docker/dockerfile:1.3 FROM docker.io/library/alpine:3.15 # https://github.com/actions/runner/issues/241 RUN apk --no-cache add bash ca-certificates make python3 util-linux WORKDIR /usr/src/app COPY asciinema/ asciinema/ COPY tests/ tests/ ENV LANG="en_US.utf8" USER nobody ENTRYPOINT ["/bin/bash"] # vim:ft=dockerfile ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/distros/Dockerfile.arch�����������������������������������������������������������������������0000664�0000000�0000000�00000000675�14515476772�0016647�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# syntax=docker/dockerfile:1.3 FROM docker.io/library/archlinux:latest RUN pacman-key --init \ && pacman --sync --refresh --sysupgrade --noconfirm make python3 \ && printf "LANG=en_US.UTF-8\n" > /etc/locale.conf \ && locale-gen \ && pacman --sync --clean --clean --noconfirm WORKDIR /usr/src/app COPY asciinema/ asciinema/ COPY tests/ tests/ ENV LANG="en_US.utf8" USER nobody ENTRYPOINT ["/bin/bash"] # vim:ft=dockerfile �������������������������������������������������������������������tests/distros/Dockerfile.centos���������������������������������������������������������������������0000664�0000000�0000000�00000000452�14515476772�0017216�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# syntax=docker/dockerfile:1.3 FROM docker.io/library/centos:7 RUN yum install -y epel-release && yum install -y make python36 && yum clean all WORKDIR /usr/src/app COPY asciinema/ asciinema/ COPY tests/ tests/ ENV LANG="en_US.utf8" USER nobody ENTRYPOINT ["/bin/bash"] # vim:ft=dockerfile ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/distros/Dockerfile.debian���������������������������������������������������������������������0000664�0000000�0000000�00000001075�14515476772�0017147�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# syntax=docker/dockerfile:1.3 FROM docker.io/library/debian:bullseye ENV DEBIAN_FRONTENT="noninteractive" RUN apt-get update \ && apt-get install -y \ ca-certificates \ locales \ make \ procps \ python3 \ && localedef \ -i en_US \ -c \ -f UTF-8 \ -A /usr/share/locale/locale.alias \ en_US.UTF-8 \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app COPY asciinema/ asciinema/ COPY tests/ tests/ ENV LANG="en_US.utf8" USER nobody ENV SHELL="/bin/bash" # vim:ft=dockerfile �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/distros/Dockerfile.fedora���������������������������������������������������������������������0000664�0000000�0000000�00000000736�14515476772�0017170�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# syntax=docker/dockerfile:1.3 # https://medium.com/nttlabs/ubuntu-21-10-and-fedora-35-do-not-work-on-docker-20-10-9-1cd439d9921 # https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg5971024.html FROM registry.fedoraproject.org/fedora:34 RUN dnf install -y make python3 procps && dnf clean all WORKDIR /usr/src/app COPY asciinema/ asciinema/ COPY tests/ tests/ ENV LANG="en_US.utf8" ENV SHELL="/bin/bash" USER nobody ENTRYPOINT ["/bin/bash"] # vim:ft=dockerfile ����������������������������������tests/distros/Dockerfile.ubuntu���������������������������������������������������������������������0000664�0000000�0000000�00000001054�14515476772�0017244�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# syntax=docker/dockerfile:1.3 FROM docker.io/library/ubuntu:20.04 ENV DEBIAN_FRONTENT="noninteractive" RUN apt-get update \ && apt-get install -y \ ca-certificates \ locales \ make \ python3 \ && localedef \ -i en_US \ -c \ -f UTF-8 \ -A /usr/share/locale/locale.alias \ en_US.UTF-8 \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app COPY asciinema/ asciinema/ COPY tests/ tests/ ENV LANG="en_US.utf8" USER nobody ENTRYPOINT ["/bin/bash"] # vim:ft=dockerfile ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/integration.sh��������������������������������������������������������������������������������0000775�0000000�0000000�00000005345�14515476772�0015133�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env bash set -eExuo pipefail if ! command -v "pkill" >/dev/null 2>&1; then printf "error: pkill not installed\n" exit 1 fi python3 -V ASCIINEMA_CONFIG_HOME="$( mktemp -d 2>/dev/null || mktemp -d -t asciinema-config-home )" export ASCIINEMA_CONFIG_HOME TMP_DATA_DIR="$(mktemp -d 2>/dev/null || mktemp -d -t asciinema-data-dir)" trap 'rm -rf ${ASCIINEMA_CONFIG_HOME} ${TMP_DATA_DIR}' EXIT asciinema() { python3 -m asciinema "${@}" } ## disable notifications printf "[notifications]\nenabled = no\n" >> "${ASCIINEMA_CONFIG_HOME}/config" ## test help message asciinema -h ## test version command asciinema --version ## test auth command asciinema auth ## test play command # asciicast v1 asciinema play -s 5 tests/demo.json asciinema play -s 5 -i 0.2 tests/demo.json # shellcheck disable=SC2002 cat tests/demo.json | asciinema play -s 5 - # asciicast v2 asciinema play -s 5 tests/demo.cast asciinema play -s 5 -i 0.2 tests/demo.cast # shellcheck disable=SC2002 cat tests/demo.cast | asciinema play -s 5 - ## test cat command # asciicast v1 asciinema cat tests/demo.json # shellcheck disable=SC2002 cat tests/demo.json | asciinema cat - # asciicast v2 asciinema cat tests/demo.cast # shellcheck disable=SC2002 cat tests/demo.cast | asciinema cat - ## test rec command # normal program asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "${TMP_DATA_DIR}/1a.cast" grep '"o",' "${TMP_DATA_DIR}/1a.cast" # very quickly exiting program asciinema rec -c whoami "${TMP_DATA_DIR}/1b.cast" grep '"o",' "${TMP_DATA_DIR}/1b.cast" # signal handling bash -c "sleep 1; pkill -28 -n -f 'm asciinema'" & asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "${TMP_DATA_DIR}/2.cast" bash -c "sleep 1; pkill -n -f 'bash -c echo t3st'" & asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "${TMP_DATA_DIR}/3.cast" bash -c "sleep 1; pkill -9 -n -f 'bash -c echo t3st'" & asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "${TMP_DATA_DIR}/4.cast" # with stdin recording echo "ls" | asciinema rec --stdin -c 'bash -c "sleep 1"' "${TMP_DATA_DIR}/5.cast" cat "${TMP_DATA_DIR}/5.cast" grep '"i", "ls\\n"' "${TMP_DATA_DIR}/5.cast" grep '"o",' "${TMP_DATA_DIR}/5.cast" # raw output recording asciinema rec --raw -c 'bash -c "echo t3st; sleep 1; echo ok"' "${TMP_DATA_DIR}/6.raw" # appending to existing recording asciinema rec -c 'echo allright!; sleep 0.1' "${TMP_DATA_DIR}/7.cast" asciinema rec --append -c uptime "${TMP_DATA_DIR}/7.cast" # adding a marker printf "[record]\nadd_marker_key = C-b\n" >> "${ASCIINEMA_CONFIG_HOME}/config" (bash -c "sleep 1; printf '.'; sleep 0.5; printf '\x08'; sleep 0.5; printf '\x02'; sleep 0.5; printf '\x04'") | asciinema rec -c /bin/bash "${TMP_DATA_DIR}/8.cast" grep '"m",' "${TMP_DATA_DIR}/8.cast" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/pty_test.py�����������������������������������������������������������������������������������0000664�0000000�0000000�00000002450�14515476772�0014470�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import os import pty from typing import Any, List, Union import asciinema.pty_ from .test_helper import Test class Writer: def __init__(self) -> None: self.data: List[Union[float, str]] = [] def write_stdout(self, _ts: float, data: Any) -> None: self.data.append(data) def write_stdin(self, ts: float, data: Any) -> None: raise NotImplementedError class TestRecord(Test): def setUp(self) -> None: self.real_os_write = os.write os.write = self.os_write # type: ignore def tearDown(self) -> None: os.write = self.real_os_write def os_write(self, fd: int, data: Any) -> None: if fd != pty.STDOUT_FILENO: self.real_os_write(fd, data) @staticmethod def test_record_command_writes_to_stdout() -> None: writer = Writer() command = [ "python3", "-c", ( "import sys" "; import time" "; sys.stdout.write('foo')" "; sys.stdout.flush()" "; time.sleep(0.01)" "; sys.stdout.write('bar')" ), ] asciinema.pty_.record( command, {}, writer, lambda: (80, 24), lambda s: None, {} ) assert writer.data == [b"foo", b"bar"] ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tests/test_helper.py��������������������������������������������������������������������������������0000664�0000000�0000000�00000000637�14515476772�0015140�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import sys from codecs import StreamReader from io import StringIO from typing import Optional, TextIO, Union stdout: Optional[Union[TextIO, StreamReader]] = None class Test: def setUp(self) -> None: global stdout # pylint: disable=global-statement self.real_stdout = sys.stdout sys.stdout = stdout = StringIO() def tearDown(self) -> None: sys.stdout = self.real_stdout �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������