mirror of
https://github.com/Waradu/to-streamshare.git
synced 2025-04-21 20:04:06 +02:00
init
This commit is contained in:
commit
27ac40966f
6 changed files with 1809 additions and 0 deletions
30
src/main.rs
Normal file
30
src/main.rs
Normal 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");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue