Better CLI support
This commit is contained in:
parent
8504572b83
commit
783028fc5d
3 changed files with 32 additions and 29 deletions
54
Cargo.lock
generated
54
Cargo.lock
generated
|
@ -295,9 +295,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "3.0.7"
|
version = "3.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "12e8611f9ae4e068fa3e56931fded356ff745e70987ff76924a6e0ab1c8ef2e3"
|
checksum = "8c506244a13c87262f84bf16369740d0b7c3850901b6a642aa41b031a710c473"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -945,32 +945,11 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"atty",
|
"atty",
|
||||||
"clap",
|
"clap",
|
||||||
"omegaupload-common 0.1.0",
|
"omegaupload-common 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rpassword",
|
"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]]
|
[[package]]
|
||||||
name = "omegaupload-common"
|
name = "omegaupload-common"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -993,6 +972,27 @@ dependencies = [
|
||||||
"web-sys",
|
"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]]
|
[[package]]
|
||||||
name = "omegaupload-server"
|
name = "omegaupload-server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -1435,12 +1435,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_urlencoded"
|
name = "serde_urlencoded"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
|
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"itoa 0.4.8",
|
"itoa 1.0.1",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
|
@ -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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
omegaupload-common = "0.1"
|
omegaupload-common = "0.2"
|
||||||
|
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
atty = "0.2"
|
atty = "0.2"
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct Opts {
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
enum Action {
|
enum Action {
|
||||||
|
/// Upload a paste to an omegaupload server.
|
||||||
Upload {
|
Upload {
|
||||||
/// The OmegaUpload instance to upload data to.
|
/// The OmegaUpload instance to upload data to.
|
||||||
url: Url,
|
url: Url,
|
||||||
|
@ -52,7 +53,8 @@ enum Action {
|
||||||
/// public access.
|
/// public access.
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
password: bool,
|
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>,
|
duration: Option<Expiration>,
|
||||||
/// The path to the file to upload. If none is provided, then reads
|
/// The path to the file to upload. If none is provided, then reads
|
||||||
/// stdin instead.
|
/// stdin instead.
|
||||||
|
@ -65,6 +67,7 @@ enum Action {
|
||||||
#[clap(short = 'F', long)]
|
#[clap(short = 'F', long)]
|
||||||
no_file_name_hint: bool,
|
no_file_name_hint: bool,
|
||||||
},
|
},
|
||||||
|
/// Download a paste from an omegaupload server.
|
||||||
Download {
|
Download {
|
||||||
/// The paste to download.
|
/// The paste to download.
|
||||||
url: ParsedUrl,
|
url: ParsedUrl,
|
||||||
|
|
Loading…
Reference in a new issue