Crates.io | pasteboard |
lib.rs | pasteboard |
version | 0.1.3 |
source | src |
created_at | 2019-08-07 19:26:34.710518 |
updated_at | 2021-05-14 19:53:55.696235 |
description | CLI and Rust bindings for interacting with the macOS pasteboard. |
homepage | https://github.com/segeljakt/pasteboard |
repository | https://github.com/segeljakt/pasteboard |
max_upload_size | |
id | 154857 |
size | 17,429 |
This crate provides both a CLI and Rust bindings for interacting with the macOS pasteboard.
At the command-line, pasteboard
introduces a pb
command which can be used like:
# Copy/paste string
pb copy /path/to/foo.txt
pb paste /path/to/bar.txt
# Copy image/sound
pb copy /path/to/foo.png -t image
pb copy /path/to/foo.mp3 -t sound
From Rust, pasteboard
exposes a Pasteboard
enum with copy
and paste
methods which can be used like:
use pasteboard::Pasteboard;
fn main() {
unsafe {
// Copy/paste string
Pasteboard::String.copy("/path/to/foo.txt");
Pasteboard::String.paste("/path/to/bar.txt");
// Copy image/sound
Pasteboard::Image.copy("/path/to/foo.png");
Pasteboard::Sound.copy("/path/to/foo.png");
}
}
The pb
command is able to copy files as strings, images, and sounds. However, it can only paste as strings currently, but more coverage is planned in future releases.