Add an --output argument to sq cert export.

- See #387.
This commit is contained in:
Justus Winter 2024-10-24 14:47:08 +02:00
parent db0d193527
commit 9bd2afe478
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386
2 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
use clap::Parser;
use crate::cli::types::CertDesignators;
use crate::cli::types::*;
use crate::cli::types::cert_designator::CertUserIDEmailDomainGrepArgs;
use crate::cli::types::cert_designator::NoPrefix;
use crate::cli::types::cert_designator::OptionalValue;
@ -97,6 +97,14 @@ no search criteria are specified, then this will return success.
after_help = EXAMPLES,
)]
pub struct Command {
#[clap(
default_value_t = FileOrStdout::default(),
help = FileOrStdout::HELP_OPTIONAL,
long,
value_name = FileOrStdout::VALUE_NAME,
)]
pub output: FileOrStdout,
#[clap(
long,
help = "Emit binary data",

View File

@ -10,7 +10,6 @@ use openpgp::{
use sequoia_cert_store as cert_store;
use cert_store::Store;
use crate::cli::types::FileOrStdout;
use crate::{
Sq,
print_error_chain,
@ -28,8 +27,7 @@ pub fn dispatch(sq: Sq, cmd: export::Command) -> Result<()> {
return Err(anyhow::anyhow!("no query given"));
}
let output = FileOrStdout::default();
let mut sink = output.create_pgp_safe(
let mut sink = cmd.output.create_pgp_safe(
&sq,
cmd.binary,
armor::Kind::PublicKey,