Crate shellshot

Crate shellshot 

Source
Expand description

Shellshot

Crates.io Build Status Dependency Status Documentation License MSRV codecov


Transform your command-line output into clean, shareable images with a single command.

Shellshot is a fast, cross-platform tool written in Rust that captures terminal sessions and transforms them into polished screenshots. Perfect for documentation, presentations, social media, or showcasing terminal workflows.

§Features

  • Beautiful Rendering: High-quality image generation with customizable window decorations
  • ANSI Support: Correctly renders ANSI colors, styles, and formatting.
  • Clipboard Integration: Copy screenshots directly to your clipboard with one flag
  • Command Execution: Execute commands and capture their output automatically
  • Customizable: Adjust window decorations, colors, padding, and output filename.
  • Cross-Platform: Works on Windows and Linux

§Installation

cargo install shellshot

§Usage Examples

§Basic Usage

shellshot echo "Hello from ShellShot!"

This will execute the command, capture its output, and generate an image file named out.png in the current directory.

alt text

shellshot ping -c 5 localhost

alt text

§Command Options

§--no-decoration

Remove window decorations (title bar and control buttons):

shellshot --no-decoration echo "Hello, World!"
§--decoration <style> / -d

Specify the decoration style (default: classic):

shellshot --decoration classic ls -la
§--filename / -f

Specify a custom output filename:

shellshot --filename my-screenshot.png cargo build
shellshot --filename screenshots/build.png cargo test
§--clipboard

Copy the screenshot directly to your clipboard:

shellshot --clipboard git status

§Examples

shellshot echo "Hello, Shellshot!"
shellshot --decoration classic ls --color=always
shellshot --filename docs/example.png cargo --version
shellshot --clipboard git log --oneline -5
shellshot --no-decoration python --version

§Known Issues

  • Shellshot uses Rust’s standard library Command to capture command output. This means the output might not exactly match what you would see in a real terminal.
  • On Windows, the captured command output may have decoding issues with accented or special characters because cmd.exe does not use UTF-8 by default.
  • std::process::Command is not compatible with shell pipelines or redirections (e.g., ls | grep txt will not work as expected). You would need to run a shell explicitly to handle these.
  • Some commands that rely on interactive terminal features may not display correctly in the generated images.
  • Not all ANSI codes are fully implemented, so some complex formatting, colors, or cursor movements may not render perfectly.

Structs§

Args
Command-line arguments for shellshot
ImageRenderer
ImageRenderer is responsible for rendering a ScreenBuilder into an image using the provided window decoration and rendering metrics.

Enums§

WindowDecorationType
Type of window decoration to apply around the rendered content

Traits§

Executor
Platform-independent executor trait implemented per-OS to run shell commands.

Functions§

run_shellshot
Main entry point for shellshot logic
save_to_clipboard
Copy the provided RGBA image buffer to the system clipboard.
save_to_file
Save the provided RGBA image buffer to the given filename path.