Better CLI support

This commit is contained in:
Edward Shen 2022-01-17 21:29:39 -08:00
parent 8504572b83
commit 783028fc5d
Signed by: edward
GPG key ID: 19182661E818369F
3 changed files with 32 additions and 29 deletions

54
Cargo.lock generated
View file

@ -295,9 +295,9 @@ dependencies = [
[[package]]
name = "clap"
version = "3.0.7"
version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e8611f9ae4e068fa3e56931fded356ff745e70987ff76924a6e0ab1c8ef2e3"
checksum = "8c506244a13c87262f84bf16369740d0b7c3850901b6a642aa41b031a710c473"
dependencies = [
"atty",
"bitflags",
@ -945,32 +945,11 @@ dependencies = [
"anyhow",
"atty",
"clap",
"omegaupload-common 0.1.0",
"omegaupload-common 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest",
"rpassword",
]
[[package]]
name = "omegaupload-common"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36a9c19b1b84731bf3f90c646f168d54e1ef7b7ca91c2a8b2d39fa61ac2d95f"
dependencies = [
"argon2",
"base64",
"bytes",
"chacha20poly1305",
"chrono",
"headers",
"lazy_static",
"rand",
"secrecy",
"serde",
"thiserror",
"typenum",
"url",
]
[[package]]
name = "omegaupload-common"
version = "0.2.0"
@ -993,6 +972,27 @@ dependencies = [
"web-sys",
]
[[package]]
name = "omegaupload-common"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0e6112dcb442b5d280f65cf14b9d6749f3585709d1ed2f1b8821f12c3b6c16"
dependencies = [
"argon2",
"base64",
"bytes",
"chacha20poly1305",
"chrono",
"headers",
"lazy_static",
"rand",
"secrecy",
"serde",
"thiserror",
"typenum",
"url",
]
[[package]]
name = "omegaupload-server"
version = "0.1.0"
@ -1435,12 +1435,12 @@ dependencies = [
[[package]]
name = "serde_urlencoded"
version = "0.7.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
"itoa 0.4.8",
"itoa 1.0.1",
"ryu",
"serde",
]

View file

@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
omegaupload-common = "0.1"
omegaupload-common = "0.2"
anyhow = "1"
atty = "0.2"

View file

@ -45,6 +45,7 @@ struct Opts {
#[derive(Parser)]
enum Action {
/// Upload a paste to an omegaupload server.
Upload {
/// The OmegaUpload instance to upload data to.
url: Url,
@ -52,7 +53,8 @@ enum Action {
/// public access.
#[clap(short, long)]
password: bool,
#[clap(short, long)]
/// How long for the paste to last, or until someone has read it.
#[clap(short, long, possible_values = Expiration::variants())]
duration: Option<Expiration>,
/// The path to the file to upload. If none is provided, then reads
/// stdin instead.
@ -65,6 +67,7 @@ enum Action {
#[clap(short = 'F', long)]
no_file_name_hint: bool,
},
/// Download a paste from an omegaupload server.
Download {
/// The paste to download.
url: ParsedUrl,