This commit is contained in:
Waradu 2024-10-19 22:28:13 +02:00
commit 27ac40966f
No known key found for this signature in database
GPG key ID: F85AAC8BA8B8DAAD
6 changed files with 1809 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

1752
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

20
Cargo.toml Normal file
View file

@ -0,0 +1,20 @@
[package]
name = "to-streamshare"
version = "0.1.0"
edition = "2021"
description = "Upload to streamshare (to-ss > toss) from the terminal"
license = "MIT"
homepage = "https://waradu.dev"
repository = "https://github.com/Waradu/to-streamshare"
readme = "README.md"
authors = ["Waradu"]
keywords = ["streamshare","file-sharing","upload"]
[dependencies]
clap = { version = "4.5.20", features = ["derive"] }
streamshare = "1.0.0"
tokio = { version = "1.40.0", features = ["full"] }
[[bin]]
name = "toss"
path = "src/main.rs"

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# To Streamshare
Upload files to [streamshare](https://streamshare.wireway.ch) with the terminal.
Run `cargo install to-streamshare` to install it and use it with `toss "filepath"`

30
src/main.rs Normal file
View file

@ -0,0 +1,30 @@
use clap::Parser;
use streamshare::upload;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
file: Option<String>,
}
#[tokio::main]
async fn main() {
let args = Args::parse();
if let Some(file_path) = args.file {
match upload(&file_path).await {
Ok((file_identifier, _deletion_token)) => {
let download_url = format!(
"https://streamshare.wireway.ch/download/{}",
file_identifier
);
println!("File uploaded successfully");
println!("Download URL: {}", download_url);
}
Err(e) => eprintln!("Error: {}", e),
}
} else {
eprintln!("Please provide a file path");
}
}

1
test.txt Normal file
View file

@ -0,0 +1 @@
hello