Initial import

This commit is contained in:
Moritz Bitsch 2024-03-31 20:18:12 +02:00
commit 1e632f4361
No known key found for this signature in database
4 changed files with 131 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

109
Cargo.lock generated Normal file
View file

@ -0,0 +1,109 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "base64"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "base64-stream"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b17698d5fd7ede49ee2bbc32d6c35288376b1465f6046088370fce74f2240548"
dependencies = [
"base64",
"educe",
"generic-array",
]
[[package]]
name = "educe"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4bd92664bf78c4d3dba9b7cdafce6fa15b13ed3ed16175218196942e99168a8"
dependencies = [
"enum-ordinalize",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "enum-ordinalize"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5"
dependencies = [
"enum-ordinalize-derive",
]
[[package]]
name = "enum-ordinalize-derive"
version = "4.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "generic-array"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe739944a5406424e080edccb6add95685130b9f160d5407c639c7df0c5836b0"
dependencies = [
"typenum",
]
[[package]]
name = "osclip"
version = "0.1.0"
dependencies = [
"base64-stream",
]
[[package]]
name = "proc-macro2"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
version = "2.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "typenum"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"

9
Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "osclip"
version = "0.0.0"
edition = "2021"
description = "Simple OSC52 copy program"
license = "ISC"
[dependencies]
base64-stream = "3.0.1"

12
src/main.rs Normal file
View file

@ -0,0 +1,12 @@
use std::io::{Result, Write};
fn main() -> Result<()> {
std::io::stdout().write_all(&[0x1b, 0x5d])?;
std::io::stdout().write_all(b"52;c;")?;
let mut writer = base64_stream::ToBase64Writer::new(std::io::stdout());
std::io::copy(&mut std::io::stdin(), &mut writer)?;
writer.flush()?;
std::io::stdout().write_all(&[0x07, 0x0a])
}