mirror of
https://github.com/Waradu/to-streamshare.git
synced 2025-04-20 19:34:08 +02:00
added replace when downloading option
This commit is contained in:
parent
a452ff1631
commit
6fb6657332
4 changed files with 73 additions and 8 deletions
64
Cargo.lock
generated
64
Cargo.lock
generated
|
@ -257,6 +257,27 @@ dependencies = [
|
|||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "0.3.6"
|
||||
|
@ -670,6 +691,16 @@ version = "0.2.161"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.14"
|
||||
|
@ -801,6 +832,12 @@ dependencies = [
|
|||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "option-ext"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.3"
|
||||
|
@ -962,6 +999,17 @@ dependencies = [
|
|||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.8"
|
||||
|
@ -1189,6 +1237,15 @@ dependencies = [
|
|||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shellexpand"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b"
|
||||
dependencies = [
|
||||
"dirs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
|
@ -1237,14 +1294,15 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
|||
|
||||
[[package]]
|
||||
name = "streamshare"
|
||||
version = "4.1.0"
|
||||
version = "5.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1960eb9ada032cacbd7b75b1255468a007459729009b76e508579bd49d97171"
|
||||
checksum = "b3738f5ec13f0df9b7b1f21701dde6b1edf0b6684a82e58a4fd61936377403ef"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"shellexpand",
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
]
|
||||
|
@ -1362,7 +1420,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "to-streamshare"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"console",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "to-streamshare"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
edition = "2021"
|
||||
description = "Upload to streamshare (to-ss > toss) from the terminal"
|
||||
license = "MIT"
|
||||
|
@ -14,9 +14,9 @@ keywords = ["streamshare", "file-sharing", "upload"]
|
|||
clap = { version = "4.5.20", features = ["derive"] }
|
||||
console = "0.15.8"
|
||||
kdam = { version = "0.5.2", features = ["rich", "spinner"] }
|
||||
streamshare = "4.1"
|
||||
streamshare = "5"
|
||||
tokio = { version = "1.40.0", features = ["full"] }
|
||||
|
||||
[[bin]]
|
||||
name = "toss"
|
||||
path = "src/main.rs"
|
||||
path = "src/main.rs"
|
||||
|
|
|
@ -27,4 +27,5 @@ toss --delete "file_identifier/deletion_token"
|
|||
```bash
|
||||
toss --download "file_identifier"
|
||||
toss --download "file_identifier" --path "" # uses current path as default
|
||||
toss --download "file_identifier" --replace # replace if file already exist
|
||||
```
|
10
src/main.rs
10
src/main.rs
|
@ -46,12 +46,18 @@ struct Args {
|
|||
download: Option<String>,
|
||||
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
value_name = "PATH",
|
||||
help = "Set the path to download the file to."
|
||||
)]
|
||||
path: Option<String>,
|
||||
|
||||
#[arg(
|
||||
long,
|
||||
value_name = "REPLACE",
|
||||
help = "Replace file when downloading if it already exists.",
|
||||
)]
|
||||
replace: bool,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -83,7 +89,7 @@ async fn main() -> std::io::Result<()> {
|
|||
None => "".to_string()
|
||||
};
|
||||
|
||||
match client.download(download.as_str(), path.as_str()).await {
|
||||
match client.download(download.as_str(), path.as_str(), args.replace).await {
|
||||
Ok(_) => println!("File downloaded successfully"),
|
||||
Err(e) => eprintln!("Error downloaded file: {}", e),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue