From 725e3879d8e858c8b041bfb779c5d8776be5a42c Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Wed, 24 Jun 2026 19:06:29 +0530 Subject: [PATCH] registry: New asciicinema installer --- installers/install_asciicinema.sh | 99 +++++++++++++++++++++++++++++++ lib/registry.sh | 4 +- readme.md | 1 + 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 installers/install_asciicinema.sh diff --git a/installers/install_asciicinema.sh b/installers/install_asciicinema.sh new file mode 100644 index 0000000..e409a80 --- /dev/null +++ b/installers/install_asciicinema.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +# Tool: asciicinema +# DisplayName: asciicinema +# Description: Install asciinema terminal recorder +# +# asciinema Installer Script +# + +# Prevent standalone execution +if [ -z "${_LIB_COMMON_SOURCED:-}" ]; then + echo "Error: This script must be run through the 'b' CLI." >&2 + exit 1 +fi + +set -euo pipefail + +TMP_DIR="$(make_temp_dir)" +cleanup() { + rm -rf "$TMP_DIR" +} +trap cleanup EXIT + +install_asciicinema() { + local latest_tag="" + if has_command curl; then + log_info "Fetching latest asciinema version from GitHub..." + latest_tag=$(curl -sL https://api.github.com/repos/asciinema/asciinema/releases/latest \ + | grep '"tag_name":' | head -n1 \ + | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true) + fi + + if [ -z "$latest_tag" ]; then + latest_tag="v3.2.1" # fallback + log_warn "Failed to fetch latest version from GitHub. Falling back to: $latest_tag" + else + log_info "Latest asciinema version found: $latest_tag" + fi + + + if has_command asciinema; then + local current_version + current_version=$(asciinema --version | head -n1 | awk '{print $2}') + if [[ "$current_version" != v* ]]; then + current_version="v${current_version}" + fi + + if [[ "$current_version" == "$latest_tag" ]]; then + log_info "asciinema ${latest_tag} is already installed." + if ! confirm "Reinstall/Upgrade asciinema?"; then + log_info "Skipping asciinema installation." + return + fi + else + if ! confirm "Detecting asciinema ${current_version}. Upgrade to ${latest_tag}?"; then + log_info "Skipping asciinema installation." + return + fi + fi + else + if ! confirm "Install asciinema ${latest_tag}?"; then + log_info "Skipping asciinema installation." + return + fi + fi + + # Detect architecture + local arch + arch=$(detect_arch) + local asciinema_arch="" + case "$arch" in + x86_64) asciinema_arch="x86_64-unknown-linux-gnu" ;; + arm64) asciinema_arch="aarch64-unknown-linux-gnu" ;; + *) log_error "Unsupported architecture: $arch"; exit 1 ;; + esac + + local download_url="https://github.com/asciinema/asciinema/releases/download/${latest_tag}/asciinema-${asciinema_arch}" + + log_info "Downloading asciinema ${latest_tag} for ${arch}..." + curl -fsSL "$download_url" -o "$TMP_DIR/asciinema" + + log_info "Installing asciinema to /usr/local/bin..." + sudo cp "$TMP_DIR/asciinema" /usr/local/bin/asciinema + sudo chmod +x /usr/local/bin/asciinema + + # Create compatibility symlink matching the installer name spelling + log_info "Creating compatibility symlink for asciicinema..." + sudo ln -sf /usr/local/bin/asciinema /usr/local/bin/asciicinema + + log_success "asciinema ${latest_tag} installed." +} + +main() { + install_asciicinema + + echo + log_success "asciinema installation complete." +} + +main "$@" diff --git a/lib/registry.sh b/lib/registry.sh index 6f57301..d54f6a9 100644 --- a/lib/registry.sh +++ b/lib/registry.sh @@ -2,6 +2,7 @@ declare -A INSTALLERS=( [agy]="Antigravity CLI" + [asciicinema]="asciinema terminal recorder" [bat]="Bat (alternative to cat) and configure alias" [node]="Node.js (LTS) and NVM" [nvim]="Neovim 0.12.0 and configuration" @@ -16,6 +17,7 @@ declare -A INSTALLERS=( declare -A INSTALLER_DISPLAYS=( [agy]="Antigravity" + [asciicinema]="asciicinema" [bat]="Bat" [node]="Node" [nvim]="Neovim" @@ -28,4 +30,4 @@ declare -A INSTALLER_DISPLAYS=( [zoxide]="Zoxide" ) -INSTALLER_KEYS=(agy bat node nvim pnpm rust starship uv yay yazi zoxide) +INSTALLER_KEYS=(agy asciicinema bat node nvim pnpm rust starship uv yay yazi zoxide) diff --git a/readme.md b/readme.md index f54fff0..068783a 100644 --- a/readme.md +++ b/readme.md @@ -13,6 +13,7 @@ Here is a comparison of the size and complexity of using Bootstrap (`to b`) vers | application | to b | not to b | | :--- | :--- | :--- | | **Antigravity CLI (`agy`)** | 197 lines | 239 lines (Official Antigravity install script) | +| **asciicinema (`asciicinema`)** | 99 lines | N/A (Official binary distribution) | | **Bat (`bat`)** | 155 lines | N/A (Standard package install) | | **Node.js & NVM (`node`)** | 156 lines | 507 lines (Official NVM install script) | | **Neovim (`nvim`)** | 178 lines | N/A (Official binary/config distribution) |