Skip to content
yutadev31Public

About

A simple, cross-platform clipboard CLI

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

Repository files navigation

cpst

A lightweight, cross-platform clipboard utility written in Rust.

cpst provides two simple commands for interacting with the system clipboard:

  • cpy — Copy standard input to the clipboard.
  • pst — Paste clipboard contents to standard output.

Supports UTF-8 text and PNG/JPEG image input. Images are pasted as PNG.

Installation

Cargo

cargo install --git https://github.com/yutadev31/cpst

Nix

nix profile install github:yutadev31/cpst

Usage

Copy text

echo "Hello, world!" | cpy
cpy < file.txt

Paste text

pst
pst > file.txt

Copy an image

cpy < image.png
cpy < image.jpg

Copy a screenshot using shot:

shot | cpy

Paste an image

pst > image.png

Images are written as PNG only when standard output is redirected to a file or pipe. Binary image data is never written directly to a terminal.

When the clipboard provides both text and an image, pst prefers text.

Platform Support

cpst uses arboard for clipboard access.

It supports Windows, macOS, and Unix-like systems with a supported graphical clipboard backend, including X11 and Wayland.

Note: macOS support is currently untested due to a lack of access to macOS hardware.

Development

A Nix development environment is available:

nix develop

Run checks with Cargo:

cargo fmt --all --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test

Build the release binary:

cargo build --release

License

Licensed under the MIT License.

About

A simple, cross-platform clipboard CLI

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages