summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-10-24 12:52:16 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-10-24 12:52:16 +0200
commitae6a4413aaed99f62b00c2120dd919c3ab5ee21c (patch)
treec936e96892bf8f3c2a9116ee342452f30ebc00d1 /tool
parentdcc70d1cbe8e89f735d10c9cd66e7cfe17c73a9c (diff)
tool: Allow generation of keys with multiple userids.
- Fixes #347.
Diffstat (limited to 'tool')
-rw-r--r--tool/src/commands/key.rs6
-rw-r--r--tool/src/sq-usage.rs2
-rw-r--r--tool/src/sq_cli.rs6
3 files changed, 10 insertions, 4 deletions
diff --git a/tool/src/commands/key.rs b/tool/src/commands/key.rs
index 5b048e4a..1fda1bd7 100644
--- a/tool/src/commands/key.rs
+++ b/tool/src/commands/key.rs
@@ -15,8 +15,10 @@ pub fn generate(m: &ArgMatches, force: bool) -> failure::Fallible<()> {
let mut builder = TPKBuilder::new();
// User ID
- match m.value_of("userid") {
- Some(uid) => { builder = builder.add_userid(uid); }
+ match m.values_of("userid") {
+ Some(uids) => for uid in uids {
+ builder = builder.add_userid(uid);
+ },
None => {
eprintln!("No user ID given, using direct key signature");
}
diff --git a/tool/src/sq-usage.rs b/tool/src/sq-usage.rs
index 3c535633..554f7d08 100644
--- a/tool/src/sq-usage.rs
+++ b/tool/src/sq-usage.rs
@@ -493,7 +493,7 @@
//! -e, --export <OUTFILE> Exports the key instead of saving it in the store
//! --rev-cert <FILE or -> Sets the output file for the revocation certificate. Default is <OUTFILE>.rev,
//! mandatory if OUTFILE is '-'.
-//! -u, --userid <EMAIL> Primary user ID
+//! -u, --userid <EMAIL>... Add userid to the key (can be given multiple times)
//! ```
//!
//! ## Subcommand list
diff --git a/tool/src/sq_cli.rs b/tool/src/sq_cli.rs
index f477281a..1ac93d33 100644
--- a/tool/src/sq_cli.rs
+++ b/tool/src/sq_cli.rs
@@ -362,7 +362,11 @@ pub fn build() -> App<'static, 'static> {
.value_name("EMAIL")
.long("userid")
.short("u")
- .help("Primary user ID"))
+ .multiple(true)
+ .number_of_values(1)
+ .takes_value(true)
+ .help("Add userid to the key \
+ (can be given multiple times)"))
.arg(Arg::with_name("cipher-suite")
.value_name("CIPHER-SUITE")
.long("cipher-suite")