summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-09 16:59:26 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-09 17:00:59 +0200
commitf207cf74e99469cf7d967e4e8829c6e0e2f84432 (patch)
tree12342c2eefe68e38947e14d9ec155210bf996170 /tool
parent57e0c6e70f473c9e6a3cecfcfa012358a65e3a3d (diff)
tool: Rework 'sq wkd generate's argument handling.
Diffstat (limited to 'tool')
-rw-r--r--tool/src/sq-usage.rs16
-rw-r--r--tool/src/sq.rs5
-rw-r--r--tool/src/sq_cli.rs28
3 files changed, 25 insertions, 24 deletions
diff --git a/tool/src/sq-usage.rs b/tool/src/sq-usage.rs
index 009cff34..bc450862 100644
--- a/tool/src/sq-usage.rs
+++ b/tool/src/sq-usage.rs
@@ -670,7 +670,8 @@
//! -V, --version Prints version information
//!
//! SUBCOMMANDS:
-//! generate Generates a Web Key Directory for the given domain and keys.
+//! generate Generates a Web Key Directory for the given domain and keys. If the WKD exists, the new keys will
+//! be inserted and it is updated and existing ones will be updated.
//! get Writes to the standard output the TPK retrieved from a Web Key Directory, given an email address
//! help Prints this message or the help of the given subcommand(s)
//! url Prints the Web Key Directory URL of an email address.
@@ -679,22 +680,21 @@
//! ### Subcommand wkd generate
//!
//! ```text
-//! Generates a Web Key Directory for the given domain and keys.
+//! Generates a Web Key Directory for the given domain and keys. If the WKD exists, the new keys will be inserted and it is
+//! updated and existing ones will be updated.
//!
//! USAGE:
-//! sq wkd generate [FLAGS] [OPTIONS] <DOMAIN> [KEYRING]
+//! sq wkd generate [FLAGS] <BASE-DIRECTORY> <DOMAIN> [KEYRING]
//!
//! FLAGS:
//! -d, --direct_method Use the direct method. [default: advanced method]
//! -h, --help Prints help information
//! -V, --version Prints version information
//!
-//! OPTIONS:
-//! -o, --output <output> The top level directory directory. [default: /var/www/html]
-//!
//! ARGS:
-//! <DOMAIN> The domain for the WKD.
-//! <KEYRING> The keyring file with the keys to add to the WKD.
+//! <BASE-DIRECTORY> The location to write the WKD to
+//! <DOMAIN> The domain for the WKD.
+//! <KEYRING> The keyring file with the keys to add to the WKD.
//! ```
//!
//! ### Subcommand wkd get
diff --git a/tool/src/sq.rs b/tool/src/sq.rs
index 6cca5f33..db0b1339 100644
--- a/tool/src/sq.rs
+++ b/tool/src/sq.rs
@@ -548,9 +548,8 @@ fn real_main() -> Result<(), failure::Error> {
("generate", Some(m)) => {
let domain = m.value_of("domain").unwrap();
let f = open_or_stdin(m.value_of("input"))?;
- // XXX: is a bad idea to use this default dir?
- let base_path = m.value_of("output")
- .unwrap_or("/var/www/html");
+ let base_path =
+ m.value_of("base_directory").expect("required");
let variant = if m.is_present("direct_method") {
wkd::Variant::Direct
} else {
diff --git a/tool/src/sq_cli.rs b/tool/src/sq_cli.rs
index c26f1e4c..0ff166fe 100644
--- a/tool/src/sq_cli.rs
+++ b/tool/src/sq_cli.rs
@@ -502,19 +502,16 @@ pub fn build() -> App<'static, 'static> {
.short("B")
.help("Don't ASCII-armor encode the OpenPGP data")))
.subcommand(SubCommand::with_name("generate")
- .about("Generates a Web Key Directory for the \
- given domain and keys.")
- .arg(Arg::with_name("output")
- .long("output")
- .short("o")
- .takes_value(true)
- .help("The top level directory directory. \
- [default: /var/www/html]"))
- .arg(Arg::with_name("direct_method")
- .long("direct_method")
- .short("d")
- .help("Use the direct method. \
- [default: advanced method]"))
+ .about("Generates a Web Key Directory \
+ for the given domain and keys. \
+ If the WKD exists, the new \
+ keys will be inserted and it \
+ is updated and existing ones \
+ will be updated.")
+ .arg(Arg::with_name("base_directory")
+ .value_name("BASE-DIRECTORY")
+ .required(true)
+ .help("The location to write the WKD to"))
.arg(Arg::with_name("domain")
.value_name("DOMAIN")
.help("The domain for the WKD.")
@@ -522,6 +519,11 @@ pub fn build() -> App<'static, 'static> {
.arg(Arg::with_name("input")
.value_name("KEYRING")
.help("The keyring file with the keys to add to the WKD."))
+ .arg(Arg::with_name("direct_method")
+ .long("direct_method")
+ .short("d")
+ .help("Use the direct method. \
+ [default: advanced method]"))
)
)
}