[PR #609] [MERGED] Add convert command #1155

Closed
opened 2026-03-15 11:21:27 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/asciinema/asciinema/pull/609
Author: @ku1ik
Created: 1/25/2024
Status: Merged
Merged: 1/25/2024
Merged by: @ku1ik

Base: developHead: convert


📝 Commits (2)

  • a342b43 Include timestamp entry in the written header only when it's present
  • d8ba917 Add convert command

📊 Changes

6 files changed (+142 additions, -1 deletions)

View changed files

📝 src/asciicast/v2.rs (+8 -1)
src/cmd/convert.rs (+98 -0)
📝 src/cmd/mod.rs (+1 -0)
📝 src/encoder/asciicast.rs (+11 -0)
📝 src/encoder/mod.rs (+20 -0)
📝 src/main.rs (+4 -0)

📄 Description

$ asciinema convert -h

Convert a recording into another format

Usage: asciinema convert [OPTIONS] <INPUT_FILENAME_OR_URL> <OUTPUT_FILENAME>

Arguments:
  <INPUT_FILENAME_OR_URL>
  <OUTPUT_FILENAME>

Options:
  -f, --format <FORMAT>  Output file format [default: asciicast] [possible values: asciicast, raw, txt]
      --overwrite        Overwrite target file if it already exists

This provides conversion from asciicast (v1 and v2) into asciicast v2, raw output, or plain text log.

When output filename has .txt extension then text output is assumed (unless --format option given).

Examples:

# convert asciicast v1 to v2
asciinema convert demo.json demo.cast

# convert asciicast to plain text log
asciinema convert demo.cast demo.txt 

# convert asciicast to raw output
asciinema convert demo.cast demo.raw -f raw 

# convert asciicast from URL to plain text log
asciinema convert https://asciinema.org/a/Ry4cnZr5VHFIBRbmk9XBld5To demo.txt 

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/asciinema/asciinema/pull/609 **Author:** [@ku1ik](https://github.com/ku1ik) **Created:** 1/25/2024 **Status:** ✅ Merged **Merged:** 1/25/2024 **Merged by:** [@ku1ik](https://github.com/ku1ik) **Base:** `develop` ← **Head:** `convert` --- ### 📝 Commits (2) - [`a342b43`](https://github.com/asciinema/asciinema/commit/a342b43b4c9d0dd7761a3b0f431411a3a5b80abd) Include timestamp entry in the written header only when it's present - [`d8ba917`](https://github.com/asciinema/asciinema/commit/d8ba917146103be52ef2c63ad630a31b420e99e1) Add `convert` command ### 📊 Changes **6 files changed** (+142 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/asciicast/v2.rs` (+8 -1) ➕ `src/cmd/convert.rs` (+98 -0) 📝 `src/cmd/mod.rs` (+1 -0) 📝 `src/encoder/asciicast.rs` (+11 -0) 📝 `src/encoder/mod.rs` (+20 -0) 📝 `src/main.rs` (+4 -0) </details> ### 📄 Description ``` $ asciinema convert -h Convert a recording into another format Usage: asciinema convert [OPTIONS] <INPUT_FILENAME_OR_URL> <OUTPUT_FILENAME> Arguments: <INPUT_FILENAME_OR_URL> <OUTPUT_FILENAME> Options: -f, --format <FORMAT> Output file format [default: asciicast] [possible values: asciicast, raw, txt] --overwrite Overwrite target file if it already exists ``` This provides conversion from asciicast (v1 and v2) into asciicast v2, raw output, or plain text log. When output filename has `.txt` extension then text output is assumed (unless `--format` option given). Examples: ``` # convert asciicast v1 to v2 asciinema convert demo.json demo.cast # convert asciicast to plain text log asciinema convert demo.cast demo.txt # convert asciicast to raw output asciinema convert demo.cast demo.raw -f raw # convert asciicast from URL to plain text log asciinema convert https://asciinema.org/a/Ry4cnZr5VHFIBRbmk9XBld5To demo.txt ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-15 11:21:27 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#1155
No description provided.