Remove the DWIM interface from sq cert export
.
- The cert designator framework is expressive enough. Just be explicit.
This commit is contained in:
parent
db0fe0873d
commit
bcb5c39aca
2
NEWS
2
NEWS
@ -104,6 +104,8 @@
|
|||||||
- When exporting certificates selected by user IDs (i.e. --email,
|
- When exporting certificates selected by user IDs (i.e. --email,
|
||||||
--userid, --domain, or --grep), the bindings are authenticated and
|
--userid, --domain, or --grep), the bindings are authenticated and
|
||||||
only those certificates that can be authenticated are exported.
|
only those certificates that can be authenticated are exported.
|
||||||
|
- The do-what-I-mean query parameter has been removed from `sq cert
|
||||||
|
export`.
|
||||||
|
|
||||||
* Changes in 0.38.0
|
* Changes in 0.38.0
|
||||||
** Notable changes
|
** Notable changes
|
||||||
|
@ -123,7 +123,7 @@ for example.",
|
|||||||
#[clap(
|
#[clap(
|
||||||
long,
|
long,
|
||||||
conflicts_with_all = [
|
conflicts_with_all = [
|
||||||
"cert", "userid", "email", "domain", "grep", "query",
|
"cert", "userid", "email", "domain", "grep",
|
||||||
],
|
],
|
||||||
help = "Export all certificates",
|
help = "Export all certificates",
|
||||||
)]
|
)]
|
||||||
@ -133,12 +133,4 @@ for example.",
|
|||||||
pub certs: CertDesignators<CertUserIDEmailDomainGrepArgs,
|
pub certs: CertDesignators<CertUserIDEmailDomainGrepArgs,
|
||||||
NoPrefix,
|
NoPrefix,
|
||||||
OptionalValue>,
|
OptionalValue>,
|
||||||
|
|
||||||
#[clap(
|
|
||||||
value_name = "QUERY",
|
|
||||||
help = "Return certificates matching QUERY. \
|
|
||||||
This may be a subkey fingerprint or key ID, \
|
|
||||||
an email address, or an User ID fragment.",
|
|
||||||
)]
|
|
||||||
pub query: Vec<String>,
|
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,7 @@ use openpgp::{
|
|||||||
|
|
||||||
use sequoia_cert_store as cert_store;
|
use sequoia_cert_store as cert_store;
|
||||||
use cert_store::Store;
|
use cert_store::Store;
|
||||||
use cert_store::store::UserIDQueryParams;
|
|
||||||
|
|
||||||
use crate::cli::types::cert_designator::CertDesignator;
|
|
||||||
use crate::cli::types::FileOrStdout;
|
use crate::cli::types::FileOrStdout;
|
||||||
use crate::{
|
use crate::{
|
||||||
Sq,
|
Sq,
|
||||||
@ -21,10 +19,10 @@ use crate::{
|
|||||||
|
|
||||||
use crate::cli::cert::export;
|
use crate::cli::cert::export;
|
||||||
|
|
||||||
pub fn dispatch(sq: Sq, mut cmd: export::Command) -> Result<()> {
|
pub fn dispatch(sq: Sq, cmd: export::Command) -> Result<()> {
|
||||||
let cert_store = sq.cert_store_or_else()?;
|
let cert_store = sq.cert_store_or_else()?;
|
||||||
|
|
||||||
if cmd.certs.is_empty() && cmd.query.is_empty() && ! cmd.all {
|
if cmd.certs.is_empty() && ! cmd.all {
|
||||||
sq.hint(format_args!(
|
sq.hint(format_args!(
|
||||||
"Use --all to export all certs, or give a query."));
|
"Use --all to export all certs, or give a query."));
|
||||||
return Err(anyhow::anyhow!("no query given"));
|
return Err(anyhow::anyhow!("no query given"));
|
||||||
@ -69,20 +67,8 @@ pub fn dispatch(sq: Sq, mut cmd: export::Command) -> Result<()> {
|
|||||||
// nothing, that is fine.
|
// nothing, that is fine.
|
||||||
exported_something = true;
|
exported_something = true;
|
||||||
} else {
|
} else {
|
||||||
let mut designators = cmd.certs;
|
|
||||||
|
|
||||||
for query in cmd.query {
|
|
||||||
if let Ok(h) = query.parse() {
|
|
||||||
designators.push(CertDesignator::Cert(h));
|
|
||||||
} else if let Ok(email) = UserIDQueryParams::is_email(&query) {
|
|
||||||
designators.push(CertDesignator::Email(email));
|
|
||||||
} else {
|
|
||||||
designators.push(CertDesignator::Grep(query));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let (certs, errors)
|
let (certs, errors)
|
||||||
= sq.resolve_certs(&designators, sequoia_wot::FULLY_TRUSTED)?;
|
= sq.resolve_certs(&cmd.certs, sequoia_wot::FULLY_TRUSTED)?;
|
||||||
for error in errors.iter() {
|
for error in errors.iter() {
|
||||||
print_error_chain(error);
|
print_error_chain(error);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user