diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-01-22 00:16:08 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-01-22 08:33:14 +0100 |
commit | 035af448511f8a4bb5f9693b7b005fae5e9c8fdf (patch) | |
tree | 62bc1a821b26362f3e6e5263ac348c724d2068e4 | |
parent | 6e94e63d8a5ad8a200946ecc398e7f87616d6d72 (diff) |
sq: Make key adopt's target-key argument optional.
-rw-r--r-- | sq/src/commands/key.rs | 5 | ||||
-rw-r--r-- | sq/src/sq-usage.rs | 2 | ||||
-rw-r--r-- | sq/src/sq_cli.rs | 1 |
3 files changed, 3 insertions, 5 deletions
diff --git a/sq/src/commands/key.rs b/sq/src/commands/key.rs index 7cf183a2..25ec4ff5 100644 --- a/sq/src/commands/key.rs +++ b/sq/src/commands/key.rs @@ -195,9 +195,8 @@ pub fn generate(m: &ArgMatches, force: bool) -> Result<()> { } pub fn adopt(config: Config, m: &ArgMatches, p: &dyn Policy) -> Result<()> { - let cert = m.value_of("certificate").unwrap(); - let cert = Cert::from_file(cert) - .context(format!("Parsing {}", cert))?; + let input = open_or_stdin(m.value_of("certificate"))?; + let cert = Cert::from_reader(input)?; let mut wanted: Vec<(KeyHandle, Option<(Key<key::PublicParts, key::SubordinateRole>, SignatureBuilder)>)> diff --git a/sq/src/sq-usage.rs b/sq/src/sq-usage.rs index c8f3e5aa..5d5fe69b 100644 --- a/sq/src/sq-usage.rs +++ b/sq/src/sq-usage.rs @@ -299,7 +299,7 @@ //! Binds keys from one certificate to another //! //! USAGE: -//! sq key adopt [FLAGS] [OPTIONS] <TARGET-KEY> --key <KEY>... +//! sq key adopt [FLAGS] [OPTIONS] --key <KEY>... [--] [TARGET-KEY] //! //! FLAGS: //! --allow-broken-crypto diff --git a/sq/src/sq_cli.rs b/sq/src/sq_cli.rs index 25065a54..2045b01f 100644 --- a/sq/src/sq_cli.rs +++ b/sq/src/sq_cli.rs @@ -392,7 +392,6 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { using broken cryptography")) .arg(Arg::with_name("certificate") .value_name("TARGET-KEY") - .required(true) .help("Adds keys to TARGET-KEY")) .arg(Arg::with_name("output") .short("o").long("output").value_name("FILE") |