From 783028fc5d5247dd43d108ed7dcd453a0ec844e6 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Mon, 17 Jan 2022 21:29:39 -0800 Subject: [PATCH] Better CLI support --- Cargo.lock | 54 ++++++++++++++++++++++++------------------------- cli/Cargo.toml | 2 +- cli/src/main.rs | 5 ++++- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68f6564..2a72116 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index b47554d..e5486eb 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -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" diff --git a/cli/src/main.rs b/cli/src/main.rs index 82a9d46..b80bcca 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -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, /// 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,