rscopy 0.1.0

A simple Rust implementation of pbcopy 🦀📋.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate clipboard;

use clipboard::ClipboardContext;
use clipboard::ClipboardProvider;
use std::io::{self, Read};

fn main() {
    // Read all of stdin into a string
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();

    // Initialize clipboard context
    let mut ctx: ClipboardContext = ClipboardProvider::new().unwrap();

    // Set clipboard contents
    ctx.set_contents(input).unwrap();
}