Rename wprintln to weprintln.
- This change is in preparation for a `stdout` variant. - See #342.
This commit is contained in:
parent
fc617dee6b
commit
8902710333
@ -92,7 +92,7 @@ pub fn import_certs(sq: &mut Sq, source: &mut Box<dyn BufferedReader<Cookie>>,
|
||||
Err(e) => {
|
||||
// The decryption failed, but we should still import the
|
||||
// Autocrypt header.
|
||||
wprintln!("Note: Decryption of message failed: {}", e);
|
||||
weprintln!("Note: Decryption of message failed: {}", e);
|
||||
return Ok(());
|
||||
},
|
||||
};
|
||||
|
@ -110,7 +110,7 @@ where 'store: 'rstore
|
||||
|
||||
let result = inner();
|
||||
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
stats.print_summary(&sq)?;
|
||||
|
||||
Ok(result?)
|
||||
@ -163,12 +163,12 @@ fn import_certs(sq: &mut Sq,
|
||||
if let Err(err) = cert_store.update_by(Arc::new(cert.into()),
|
||||
stats)
|
||||
{
|
||||
wprintln!("Error importing {}, {}: {}",
|
||||
weprintln!("Error importing {}, {}: {}",
|
||||
fingerprint, sanitized_userid, err);
|
||||
stats.certs.inc_errors();
|
||||
continue;
|
||||
} else {
|
||||
wprintln!("Imported {}, {}", fingerprint, sanitized_userid);
|
||||
weprintln!("Imported {}, {}", fingerprint, sanitized_userid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ fn import_certs(sq: &mut Sq,
|
||||
Err(errors.pop().ok_or_else(|| anyhow::anyhow!("no cert found"))?)
|
||||
} else {
|
||||
for err in errors {
|
||||
wprintln!("Error parsing input: {}", err);
|
||||
weprintln!("Error parsing input: {}", err);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -248,13 +248,13 @@ fn import_rev(sq: &mut Sq,
|
||||
if let Err(err) = cert_store.update_by(Arc::new(cert.into()),
|
||||
stats)
|
||||
{
|
||||
wprintln!("Error importing revocation certificate \
|
||||
weprintln!("Error importing revocation certificate \
|
||||
for {}, {}: {}",
|
||||
fingerprint, sanitized_userid, err);
|
||||
stats.certs.inc_errors();
|
||||
continue;
|
||||
} else {
|
||||
wprintln!("Imported revocation certificate \
|
||||
weprintln!("Imported revocation certificate \
|
||||
for {}, {}",
|
||||
fingerprint, sanitized_userid);
|
||||
}
|
||||
@ -267,12 +267,12 @@ fn import_rev(sq: &mut Sq,
|
||||
}
|
||||
|
||||
let search: Option<&KeyHandle> = if let Some(bad) = bad.first() {
|
||||
wprintln!("Appears to be a revocation for {}, \
|
||||
weprintln!("Appears to be a revocation for {}, \
|
||||
but the certificate is not available.",
|
||||
bad);
|
||||
Some(bad)
|
||||
} else if ! missing.is_empty() {
|
||||
wprintln!("Appears to be a revocation for {}, \
|
||||
weprintln!("Appears to be a revocation for {}, \
|
||||
but the certificate is not available.",
|
||||
missing.iter()
|
||||
.map(|issuer| issuer.to_string())
|
||||
|
@ -274,7 +274,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
found_issue = true;
|
||||
}
|
||||
if ! sq.quiet() {
|
||||
wprintln!($($arg)*);
|
||||
weprintln!($($arg)*);
|
||||
}
|
||||
}
|
||||
}};
|
||||
@ -408,7 +408,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
}
|
||||
Err(err) => {
|
||||
unfixed_issue += 1;
|
||||
wprintln!("Certificate {}: \
|
||||
weprintln!("Certificate {}: \
|
||||
Failed to update \
|
||||
revocation certificate \
|
||||
{:02X}{:02X}: {}",
|
||||
@ -531,7 +531,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
}
|
||||
Err(err) => {
|
||||
unfixed_issue += 1;
|
||||
wprintln!("Certificate {}: User ID {}: \
|
||||
weprintln!("Certificate {}: User ID {}: \
|
||||
Failed to update \
|
||||
binding signature: {}",
|
||||
cert.keyid().to_hex(),
|
||||
@ -582,7 +582,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
Ok(sig) => updates.push(sig),
|
||||
Err(err) => {
|
||||
unfixed_issue += 1;
|
||||
wprintln!("Certificate {}, key {}: \
|
||||
weprintln!("Certificate {}, key {}: \
|
||||
Failed to update \
|
||||
binding signature: {}",
|
||||
cert.keyid().to_hex(),
|
||||
@ -631,7 +631,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
backsigs.dedup();
|
||||
|
||||
if backsigs.len() > 1 {
|
||||
wprintln!("Warning: multiple cryptographically \
|
||||
weprintln!("Warning: multiple cryptographically \
|
||||
valid backsigs.");
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
Ok(sig) => updates.push(sig),
|
||||
Err(err) => {
|
||||
unfixed_issue += 1;
|
||||
wprintln!("Certificate {}, key: {}: \
|
||||
weprintln!("Certificate {}, key: {}: \
|
||||
Failed to update \
|
||||
binding signature: {}",
|
||||
cert.keyid().to_hex(),
|
||||
@ -735,12 +735,12 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
eprint!("GOOD");
|
||||
}
|
||||
}
|
||||
wprintln!(")");
|
||||
weprintln!(")");
|
||||
}};
|
||||
}
|
||||
|
||||
if certs_with_issues > 0 {
|
||||
wprintln!("Examined {} {}.",
|
||||
weprintln!("Examined {} {}.",
|
||||
certs_valid + certs_invalid,
|
||||
pl(certs_valid + certs_invalid,
|
||||
"certificate", "certificates"));
|
||||
@ -752,7 +752,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
pl(certs_invalid, "certificate is", "certificates are"),
|
||||
pl(certs_invalid, "was", "were"));
|
||||
if certs_valid > 0 {
|
||||
wprintln!(" {} {} linted.",
|
||||
weprintln!(" {} {} linted.",
|
||||
certs_valid,
|
||||
pl(certs_valid,
|
||||
"certificate was", "certificates were"));
|
||||
@ -763,7 +763,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
certs_valid + certs_invalid,
|
||||
certs_with_issues * 100 / (certs_valid + certs_invalid),
|
||||
pl(certs_with_issues, "has", "have"));
|
||||
wprintln!("{} of the linted certificates {} revoked.",
|
||||
weprintln!("{} of the linted certificates {} revoked.",
|
||||
certs_revoked,
|
||||
pl(certs_revoked, "was", "were"));
|
||||
err!(certs_with_inadequota_revocations,
|
||||
@ -772,10 +772,10 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
recreated.",
|
||||
certs_with_inadequota_revocations,
|
||||
certs_revoked);
|
||||
wprintln!("{} of the linted certificates {} expired.",
|
||||
weprintln!("{} of the linted certificates {} expired.",
|
||||
certs_expired,
|
||||
pl(certs_expired, "was", "were"));
|
||||
wprintln!("{} of the non-revoked linted {} at least one non-revoked User ID:",
|
||||
weprintln!("{} of the non-revoked linted {} at least one non-revoked User ID:",
|
||||
certs_sp_sha1_userids,
|
||||
pl(certs_sp_sha1_userids,
|
||||
"certificate has", "certificates have"));
|
||||
@ -788,7 +788,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
certs_with_only_sha1_protected_userids,
|
||||
pl(certs_with_only_sha1_protected_userids,
|
||||
"has", "have"));
|
||||
wprintln!("{} of the non-revoked linted certificates {} at least one \
|
||||
weprintln!("{} of the non-revoked linted certificates {} at least one \
|
||||
non-revoked, live subkey:",
|
||||
certs_with_subkeys,
|
||||
pl(certs_with_subkeys,
|
||||
@ -799,7 +799,7 @@ pub fn lint(sq: Sq, mut args: Command) -> Result<()> {
|
||||
certs_with_a_sha1_protected_binding_sig,
|
||||
pl(certs_with_a_sha1_protected_binding_sig,
|
||||
"has", "have"));
|
||||
wprintln!("{} of the non-revoked linted certificates {} at least one non-revoked, live, \
|
||||
weprintln!("{} of the non-revoked linted certificates {} at least one non-revoked, live, \
|
||||
signing-capable subkey:",
|
||||
certs_with_signing_subkeys,
|
||||
pl(certs_with_signing_subkeys,
|
||||
|
@ -35,21 +35,21 @@ fn network(sq: Sq, _: inspect::network::Command) -> Result<()> {
|
||||
}
|
||||
|
||||
// First, sq network search, the most general interface.
|
||||
wprintln!(initial_indent = " - ", "sq network search");
|
||||
wprintln!(initial_indent = " - ", "{}",
|
||||
weprintln!(initial_indent = " - ", "sq network search");
|
||||
weprintln!(initial_indent = " - ", "{}",
|
||||
may_use("WKD", sq.config.network_search_wkd()));
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"relevant setting: network.search.use-wkd");
|
||||
if sq.config.network_search_wkd() {
|
||||
wprintln!(initial_indent = " - ", "see below for impact");
|
||||
weprintln!(initial_indent = " - ", "see below for impact");
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}",
|
||||
weprintln!(initial_indent = " - ", "{}",
|
||||
may_use("DANE", sq.config.network_search_dane()));
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"relevant setting: network.search.use-dane");
|
||||
if sq.config.network_search_dane() {
|
||||
wprintln!(initial_indent = " - ", "see below for impact");
|
||||
weprintln!(initial_indent = " - ", "see below for impact");
|
||||
}
|
||||
|
||||
let key_servers = sq.config.key_servers(
|
||||
@ -58,28 +58,28 @@ fn network(sq: Sq, _: inspect::network::Command) -> Result<()> {
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if key_servers.is_empty() {
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"will use no key servers by default");
|
||||
} else {
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"will use the following key servers");
|
||||
for s in &key_servers {
|
||||
wprintln!(initial_indent = " - ", "{}", s);
|
||||
weprintln!(initial_indent = " - ", "{}", s);
|
||||
}
|
||||
}
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"relevant setting: network.keyservers");
|
||||
if ! key_servers.is_empty() {
|
||||
wprintln!(initial_indent = " - ", "see below for impact");
|
||||
weprintln!(initial_indent = " - ", "see below for impact");
|
||||
}
|
||||
|
||||
if sq.config.network_search_iterations() > 1 {
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"will iteratively search up to {} steps from \
|
||||
your original query to discover related \
|
||||
certificates",
|
||||
sq.config.network_search_iterations().saturating_sub(1));
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"this will query certificates that you did not \
|
||||
request, hopefully finding relevant related \
|
||||
certificates, but increases the metadata \
|
||||
@ -88,51 +88,51 @@ fn network(sq: Sq, _: inspect::network::Command) -> Result<()> {
|
||||
}
|
||||
|
||||
// Then, sq network keyserver search.
|
||||
wprintln!();
|
||||
wprintln!(initial_indent = " - ", "sq network keyserver search");
|
||||
weprintln!();
|
||||
weprintln!(initial_indent = " - ", "sq network keyserver search");
|
||||
if key_servers.is_empty() {
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"will use no key servers by default");
|
||||
} else {
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"will use the following key servers");
|
||||
for s in &key_servers {
|
||||
wprintln!(initial_indent = " - ", "{}", s);
|
||||
weprintln!(initial_indent = " - ", "{}", s);
|
||||
}
|
||||
}
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"relevant setting: network.keyservers");
|
||||
wprintln!(initial_indent = " - ", "impact:");
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ", "impact:");
|
||||
weprintln!(initial_indent = " - ",
|
||||
"key servers and their operators can see all requests, \
|
||||
and learn about your contacts, and track you");
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"although the traffic is encrypted, network observers \
|
||||
can use traffic analysis and observe the size of requests \
|
||||
and responses, and infer information about you and \
|
||||
your contacts, and track you");
|
||||
|
||||
// Then, sq network wkd search.
|
||||
wprintln!();
|
||||
wprintln!(initial_indent = " - ", "sq network wkd search");
|
||||
wprintln!(initial_indent = " - ", "impact:");
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!();
|
||||
weprintln!(initial_indent = " - ", "sq network wkd search");
|
||||
weprintln!(initial_indent = " - ", "impact:");
|
||||
weprintln!(initial_indent = " - ",
|
||||
"WKD servers and their operators can see all requests, \
|
||||
and learn about your contacts, and track you");
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"although the traffic is encrypted, network observers \
|
||||
can use traffic analysis, and observe the size of requests \
|
||||
and responses, and infer information about you and \
|
||||
your contacts, and possibly track you");
|
||||
|
||||
// Then, sq network dane search.
|
||||
wprintln!();
|
||||
wprintln!(initial_indent = " - ", "sq network dane search");
|
||||
wprintln!(initial_indent = " - ", "impact:");
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!();
|
||||
weprintln!(initial_indent = " - ", "sq network dane search");
|
||||
weprintln!(initial_indent = " - ", "impact:");
|
||||
weprintln!(initial_indent = " - ",
|
||||
"DNS servers and their operators can see all requests, \
|
||||
and learn about your contacts, and track you");
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"the traffic is not encrypted, network observers \
|
||||
can see all requests, and learn about your contacts, \
|
||||
and track you");
|
||||
@ -147,18 +147,18 @@ fn paths(sq: Sq, _: inspect::paths::Command) -> Result<()> {
|
||||
// Formats a path.
|
||||
let mut p = |path: &Path, name: &str, description: &str| -> Result<()> {
|
||||
if dirty {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
dirty = true;
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}", name);
|
||||
wprintln!(initial_indent = " - ", "{}", path.display());
|
||||
weprintln!(initial_indent = " - ", "{}", name);
|
||||
weprintln!(initial_indent = " - ", "{}", path.display());
|
||||
|
||||
if ! path.exists() {
|
||||
wprintln!(initial_indent = " - ", "does not exist");
|
||||
weprintln!(initial_indent = " - ", "does not exist");
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}", description);
|
||||
weprintln!(initial_indent = " - ", "{}", description);
|
||||
|
||||
Ok(())
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ pub fn dispatch(sq: Sq, command: cli::decrypt::Command) -> Result<()> {
|
||||
if result.is_err() {
|
||||
if let Some(path) = command.output.path() {
|
||||
if let Err(err) = std::fs::remove_file(path) {
|
||||
wprintln!("Decryption failed, failed to remove \
|
||||
weprintln!("Decryption failed, failed to remove \
|
||||
output saved to {}: {}",
|
||||
path.display(), err);
|
||||
}
|
||||
@ -155,7 +155,7 @@ impl<'c, 'store, 'rstore> Helper<'c, 'store, 'rstore>
|
||||
{
|
||||
if decrypt(algo, &sk) {
|
||||
if self.dump_session_key {
|
||||
wprintln!("Session key: {}", hex::encode(&sk));
|
||||
weprintln!("Session key: {}", hex::encode(&sk));
|
||||
}
|
||||
let id = self.key_identities.get(&KeyID::from(fpr)).cloned();
|
||||
if let Some(ref id) = id {
|
||||
@ -360,13 +360,13 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
}
|
||||
Ok(Some(password)) => {
|
||||
if let Err(_err) = key.unlock(password) {
|
||||
wprintln!("Bad password.");
|
||||
weprintln!("Bad password.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
// Cancelled.
|
||||
wprintln!("Skipping {}, {}",
|
||||
weprintln!("Skipping {}, {}",
|
||||
keyid, userid);
|
||||
break;
|
||||
}
|
||||
@ -391,7 +391,7 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
wprintln!("Warning: unable to connect to keystore: {}",
|
||||
weprintln!("Warning: unable to connect to keystore: {}",
|
||||
err);
|
||||
}
|
||||
}
|
||||
@ -406,9 +406,9 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
Some(recipient)
|
||||
}
|
||||
});
|
||||
wprintln!("No key to decrypt message. The message appears \
|
||||
weprintln!("No key to decrypt message. The message appears \
|
||||
to be encrypted to:");
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
for recipient in recipients.into_iter() {
|
||||
let certs = self.sq.lookup(
|
||||
std::iter::once(KeyHandle::from(recipient)),
|
||||
@ -421,7 +421,7 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
match certs {
|
||||
Ok(certs) => {
|
||||
for cert in certs {
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"{}, {}",
|
||||
cert.fingerprint(),
|
||||
self.sq.best_userid(&cert, true));
|
||||
@ -431,18 +431,18 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
if let Some(StoreError::NotFound(_))
|
||||
= err.downcast_ref()
|
||||
{
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"{}, certificate not found",
|
||||
recipient);
|
||||
} else {
|
||||
wprintln!(initial_indent = " - ",
|
||||
weprintln!(initial_indent = " - ",
|
||||
"{}, error looking up certificate: {}",
|
||||
recipient, err);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
|
||||
return
|
||||
Err(anyhow::anyhow!("No key to decrypt message"));
|
||||
@ -456,7 +456,7 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
.and_then(|(algo, sk)| { if decrypt(algo, &sk) { Some(sk) } else { None }})
|
||||
{
|
||||
if self.dump_session_key {
|
||||
wprintln!("Session key: {}", hex::encode(&sk));
|
||||
weprintln!("Session key: {}", hex::encode(&sk));
|
||||
}
|
||||
return Ok(None);
|
||||
}
|
||||
@ -474,7 +474,7 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
.and_then(|(algo, sk)| { if decrypt(algo, &sk) { Some(sk) } else { None }})
|
||||
{
|
||||
if self.dump_session_key {
|
||||
wprintln!("Session key: {}", hex::encode(&sk));
|
||||
weprintln!("Session key: {}", hex::encode(&sk));
|
||||
}
|
||||
return Ok(None);
|
||||
}
|
||||
@ -485,11 +485,11 @@ impl<'c, 'store, 'rstore> DecryptionHelper for Helper<'c, 'store, 'rstore>
|
||||
}
|
||||
|
||||
if first {
|
||||
wprintln!("Incorrect password. \
|
||||
weprintln!("Incorrect password. \
|
||||
Hint: enter empty password to cancel.");
|
||||
first = false;
|
||||
} else {
|
||||
wprintln!("Incorrect password.");
|
||||
weprintln!("Incorrect password.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ pub fn dispatch(sq: Sq, c: download::Command)
|
||||
let output_is_terminal
|
||||
= output.path().is_none() && std::io::stdout().is_terminal();
|
||||
if output_is_terminal {
|
||||
wprintln!("Warning: will write the data to stdout, \
|
||||
weprintln!("Warning: will write the data to stdout, \
|
||||
which appears to be a terminal. Use --output \
|
||||
to write to a file instead.");
|
||||
}
|
||||
@ -406,12 +406,12 @@ pub fn dispatch(sq: Sq, c: download::Command)
|
||||
).is_ok();
|
||||
|
||||
if good {
|
||||
wprintln!("Authenticated possible \
|
||||
weprintln!("Authenticated possible \
|
||||
signer: {}, {}",
|
||||
cert.fingerprint(),
|
||||
sq.best_userid(&cert, true));
|
||||
} else {
|
||||
wprintln!("Couldn't authenticate the \
|
||||
weprintln!("Couldn't authenticate the \
|
||||
alleged signer: {}, {}",
|
||||
cert.fingerprint(),
|
||||
sq.best_userid(&cert, true));
|
||||
@ -519,9 +519,9 @@ pub fn dispatch(sq: Sq, c: download::Command)
|
||||
|
||||
drop(progress_bar);
|
||||
|
||||
wprintln!();
|
||||
wprintln!("Finished downloading data. Authenticating data.");
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
weprintln!("Finished downloading data. Authenticating data.");
|
||||
weprintln!();
|
||||
|
||||
data_file.as_mut().rewind()?;
|
||||
|
||||
@ -536,7 +536,7 @@ pub fn dispatch(sq: Sq, c: download::Command)
|
||||
if let Err(err) = result {
|
||||
if let Some(path) = output.path() {
|
||||
if let Err(err) = std::fs::remove_file(path) {
|
||||
wprintln!("Verification failed, failed to remove \
|
||||
weprintln!("Verification failed, failed to remove \
|
||||
unverified output saved to {}: {}",
|
||||
path.display(), err);
|
||||
}
|
||||
|
@ -259,11 +259,11 @@ pub fn encrypt<'a, 'b: 'a>(
|
||||
}
|
||||
|
||||
if ! bad.is_empty() {
|
||||
wprintln!("Cannot encrypt to {}, {}:",
|
||||
weprintln!("Cannot encrypt to {}, {}:",
|
||||
cert.fingerprint(),
|
||||
sq.best_userid(&cert, true));
|
||||
for message in bad.into_iter() {
|
||||
wprintln!(initial_indent=" - ", "{}", message);
|
||||
weprintln!(initial_indent=" - ", "{}", message);
|
||||
}
|
||||
}
|
||||
if ! use_expired_subkey && ! expired_keys.is_empty() {
|
||||
|
@ -65,8 +65,9 @@ pub fn dispatch(mut sq: Sq, c: inspect::Command)
|
||||
if c.certs.is_empty() {
|
||||
if let Some(path) = input.inner() {
|
||||
if ! path.exists() &&
|
||||
format!("{}", input).parse::<KeyHandle>().is_ok() {
|
||||
wprintln!("The file {} does not exist, \
|
||||
format!("{}", input).parse::<KeyHandle>().is_ok()
|
||||
{
|
||||
weprintln!("The file {} does not exist, \
|
||||
did you mean \"sq inspect --cert {}\"?",
|
||||
input, input);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ fn list(sq: Sq, cmd: approvals::ListCommand) -> Result<()> {
|
||||
continue;
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}",
|
||||
weprintln!(initial_indent = " - ", "{}",
|
||||
String::from_utf8_lossy(uid.value()));
|
||||
|
||||
let approved =
|
||||
@ -108,7 +108,7 @@ fn list(sq: Sq, cmd: approvals::ListCommand) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}{}: {}",
|
||||
weprintln!(initial_indent = " - ", "{}{}: {}",
|
||||
issuer.as_ref()
|
||||
.map(|c| format!("{} ", c.fingerprint()))
|
||||
.unwrap_or_else(|| "".into()),
|
||||
@ -133,7 +133,7 @@ fn list(sq: Sq, cmd: approvals::ListCommand) -> Result<()> {
|
||||
}
|
||||
|
||||
if ! any {
|
||||
wprintln!(initial_indent = " - ", "no {} certifications",
|
||||
weprintln!(initial_indent = " - ", "no {} certifications",
|
||||
if cmd.pending {
|
||||
"unapproved"
|
||||
} else {
|
||||
@ -144,7 +144,7 @@ fn list(sq: Sq, cmd: approvals::ListCommand) -> Result<()> {
|
||||
assert!(designated_userids.is_empty());
|
||||
|
||||
if ! cmd.pending && pending > 0 {
|
||||
wprintln!("{} certifications are pending approval. Using `--pending` \
|
||||
weprintln!("{} certifications are pending approval. Using `--pending` \
|
||||
to see them.",
|
||||
pending);
|
||||
}
|
||||
@ -192,7 +192,7 @@ fn update(
|
||||
continue;
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}",
|
||||
weprintln!(initial_indent = " - ", "{}",
|
||||
String::from_utf8_lossy(uid.value()));
|
||||
|
||||
let previously_approved =
|
||||
@ -362,7 +362,7 @@ fn update(
|
||||
removed += 1;
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " ", "{} {}{}: {}",
|
||||
weprintln!(initial_indent = " ", "{} {}{}: {}",
|
||||
match (prev, next) {
|
||||
(false, false) => '.',
|
||||
(true, false) => '-',
|
||||
@ -395,7 +395,7 @@ fn update(
|
||||
}
|
||||
|
||||
if ! any {
|
||||
wprintln!(" no certifications");
|
||||
weprintln!(" no certifications");
|
||||
}
|
||||
|
||||
approval_signatures.append(&mut uid.attest_certifications2(
|
||||
@ -409,18 +409,18 @@ fn update(
|
||||
|
||||
match (added, removed) {
|
||||
(1, 1) => {
|
||||
wprintln!("1 new approval, 1 approval retracted");
|
||||
weprintln!("1 new approval, 1 approval retracted");
|
||||
}
|
||||
(added, 1) => {
|
||||
wprintln!("{} new approvals, 1 approval retracted",
|
||||
weprintln!("{} new approvals, 1 approval retracted",
|
||||
added);
|
||||
}
|
||||
(1, removed) => {
|
||||
wprintln!("1 new approval, {} approvals retracted",
|
||||
weprintln!("1 new approval, {} approvals retracted",
|
||||
removed);
|
||||
}
|
||||
(added, removed) => {
|
||||
wprintln!("{} new approvals, {} approvals retracted",
|
||||
weprintln!("{} new approvals, {} approvals retracted",
|
||||
added, removed);
|
||||
}
|
||||
}
|
||||
@ -454,7 +454,7 @@ fn update(
|
||||
} else {
|
||||
let fipr = key.fingerprint();
|
||||
if let Err(err) = sq.import_cert(key) {
|
||||
wprintln!("Error importing updated cert: {}", err);
|
||||
weprintln!("Error importing updated cert: {}", err);
|
||||
return Err(err);
|
||||
} else {
|
||||
sq.hint(format_args!(
|
||||
|
@ -84,14 +84,14 @@ pub fn dispatch(sq: Sq, command: cli::key::delete::Command)
|
||||
}
|
||||
}
|
||||
if ! bad.is_empty() {
|
||||
wprintln!("Some keys are not valid according \
|
||||
weprintln!("Some keys are not valid according \
|
||||
to the current policy:");
|
||||
for (fpr, err) in bad.into_iter() {
|
||||
wprintln!(" - {}: {}",
|
||||
weprintln!(" - {}: {}",
|
||||
fpr,
|
||||
crate::one_line_error_chain(err));
|
||||
}
|
||||
wprintln!("Cowardly refusing to delete all of the secret key \
|
||||
weprintln!("Cowardly refusing to delete all of the secret key \
|
||||
material to avoid accidentally losing data. Use \
|
||||
`sq key subkey delete` to delete the keys individually.");
|
||||
|
||||
@ -120,17 +120,17 @@ pub fn dispatch(sq: Sq, command: cli::key::delete::Command)
|
||||
{
|
||||
if certs.len() > 1 {
|
||||
die = true;
|
||||
wprintln!("{} is associated with multiple certificates:",
|
||||
weprintln!("{} is associated with multiple certificates:",
|
||||
ka.fingerprint());
|
||||
for cert in certs.iter() {
|
||||
wprintln!(" - {}", cert.fingerprint());
|
||||
weprintln!(" - {}", cert.fingerprint());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if die {
|
||||
wprintln!("Cowardly refusing to delete secret key material to \
|
||||
weprintln!("Cowardly refusing to delete secret key material to \
|
||||
avoid accidentally losing data. Use \
|
||||
`sq key subkey delete` to delete the keys \
|
||||
individually.");
|
||||
|
@ -63,7 +63,7 @@ pub fn dispatch(sq: Sq, command: cli::key::export::Command)
|
||||
|
||||
if secret_keys.is_empty() {
|
||||
for (fpr, err) in errs.into_iter() {
|
||||
wprintln!("Exporting {}: {}", fpr, err);
|
||||
weprintln!("Exporting {}: {}", fpr, err);
|
||||
}
|
||||
return Err(anyhow::anyhow!(
|
||||
"Failed to export {}: no secret key material is available",
|
||||
|
@ -68,7 +68,7 @@ pub fn generate(
|
||||
}
|
||||
|
||||
if command.userid.is_empty() {
|
||||
wprintln!("No user ID given, using direct key signature");
|
||||
weprintln!("No user ID given, using direct key signature");
|
||||
} else {
|
||||
// Make sure the user IDs are in canonical form. If not, and
|
||||
// `--allow-non-canonical-userids` is not set, error out.
|
||||
@ -339,8 +339,8 @@ pub fn generate(
|
||||
&mut (Box::new(std::io::stderr()) as Box<dyn std::io::Write + Send + Sync>),
|
||||
false, false)
|
||||
{
|
||||
wprintln!("Failed to display key: {}", err);
|
||||
wprintln!("This is probably a bug in sq, please report it to \
|
||||
weprintln!("Failed to display key: {}", err);
|
||||
weprintln!("This is probably a bug in sq, please report it to \
|
||||
https://gitlab.com/sequoia-pgp/sequoia-sq/-/issues/new .");
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ fn import_internal(sq: &Sq, command: cli::key::import::Command,
|
||||
let cert = match r {
|
||||
Ok(cert) => cert,
|
||||
Err(err) => {
|
||||
wprintln!("Error reading {}: {}", file.display(), err);
|
||||
weprintln!("Error reading {}: {}", file.display(), err);
|
||||
if ret.is_ok() {
|
||||
ret = Err(err);
|
||||
}
|
||||
@ -54,18 +54,17 @@ fn import_internal(sq: &Sq, command: cli::key::import::Command,
|
||||
let cert_is_tsk = cert.is_tsk();
|
||||
match sq.import_key(cert, stats) {
|
||||
Ok((key, cert)) => {
|
||||
wprintln!("Imported {} from {}: {}",
|
||||
weprintln!("Imported {} from {}: {}",
|
||||
id, file.display(),
|
||||
if key == cert {
|
||||
key.to_string()
|
||||
} else {
|
||||
format!("key {}, cert {}", key, cert)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Err(err) => {
|
||||
wprintln!("Error importing {} from {}: {}",
|
||||
weprintln!("Error importing {} from {}: {}",
|
||||
id, file.display(), err);
|
||||
|
||||
if ! cert_is_tsk {
|
||||
|
@ -272,7 +272,7 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
.sum::<usize>();
|
||||
|
||||
if hex >= 16 {
|
||||
wprintln!("Warning: {} looks like a fingerprint or key ID, \
|
||||
weprintln!("Warning: {} looks like a fingerprint or key ID, \
|
||||
but its invalid. Treating it as a text pattern.",
|
||||
pattern);
|
||||
}
|
||||
@ -305,7 +305,7 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
for backend in &mut backends {
|
||||
let devices = backend.list()?;
|
||||
if devices.len() == 0 {
|
||||
wprintln!(initial_indent = " - ", "Backend {} has no keys.",
|
||||
weprintln!(initial_indent = " - ", "Backend {} has no keys.",
|
||||
backend.id()?);
|
||||
dirty = true;
|
||||
}
|
||||
@ -313,7 +313,7 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
for mut device in devices {
|
||||
let keys = device.list()?;
|
||||
if keys.len() == 0 {
|
||||
wprintln!(initial_indent = " - ", "Device {}/{} has no keys.",
|
||||
weprintln!(initial_indent = " - ", "Device {}/{} has no keys.",
|
||||
backend.id()?, device.id()?);
|
||||
dirty = true;
|
||||
}
|
||||
@ -410,12 +410,12 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
}
|
||||
|
||||
if dirty {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
dirty = true;
|
||||
|
||||
// Emit metadata.
|
||||
wprintln!(initial_indent = " - ", "{}",
|
||||
weprintln!(initial_indent = " - ", "{}",
|
||||
association.key().fingerprint());
|
||||
|
||||
// Show the user IDs that can be authenticated or are self signed.
|
||||
@ -455,11 +455,11 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
}
|
||||
|
||||
if userids.is_empty() {
|
||||
wprintln!(initial_indent = " - ", "no user IDs");
|
||||
weprintln!(initial_indent = " - ", "no user IDs");
|
||||
} else {
|
||||
let userid_count = userids.len();
|
||||
if userid_count > 1 {
|
||||
wprintln!(initial_indent = " - ", "user IDs:");
|
||||
weprintln!(initial_indent = " - ", "user IDs:");
|
||||
}
|
||||
|
||||
userids.sort_by(
|
||||
@ -476,11 +476,11 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
{
|
||||
if amount > 0 || self_signed {
|
||||
if userid_count == 1 {
|
||||
wprintln!(initial_indent = " - ", "user ID: {}{}",
|
||||
weprintln!(initial_indent = " - ", "user ID: {}{}",
|
||||
userid,
|
||||
if revoked { " revoked" } else { "" });
|
||||
} else {
|
||||
wprintln!(initial_indent = " - ", "{}{}",
|
||||
weprintln!(initial_indent = " - ", "{}{}",
|
||||
userid,
|
||||
if revoked { " revoked" } else { "" });
|
||||
}
|
||||
@ -488,20 +488,20 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
wprintln!(initial_indent = " - ", "created {}",
|
||||
weprintln!(initial_indent = " - ", "created {}",
|
||||
association.key().creation_time().convert());
|
||||
|
||||
if let Some(cert) = association.cert() {
|
||||
for info in key_validity(&sq, cert, None).into_iter() {
|
||||
wprintln!(initial_indent = " - ", "{}", info);
|
||||
weprintln!(initial_indent = " - ", "{}", info);
|
||||
}
|
||||
}
|
||||
|
||||
// Primary key information, if any.
|
||||
if let Some(primary) = keys.get(&association.key().fingerprint()) {
|
||||
wprintln!(initial_indent = " - ", "usable {}", primary.usable_for());
|
||||
weprintln!(initial_indent = " - ", "usable {}", primary.usable_for());
|
||||
for loc in &primary.locations {
|
||||
wprintln!(initial_indent = " - ", "{}", loc);
|
||||
weprintln!(initial_indent = " - ", "{}", loc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -511,22 +511,22 @@ pub fn list(sq: Sq, mut cmd: cli::key::list::Command) -> Result<()> {
|
||||
.enumerate()
|
||||
{
|
||||
if i == 0 {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}", fp);
|
||||
wprintln!(initial_indent = " - ", "created {}",
|
||||
weprintln!(initial_indent = " - ", "{}", fp);
|
||||
weprintln!(initial_indent = " - ", "created {}",
|
||||
key.key.creation_time().convert());
|
||||
|
||||
if let Some(cert) = association.cert() {
|
||||
for info in key_validity(&sq, cert, Some(fp)).into_iter() {
|
||||
wprintln!(initial_indent = " - ", "{}", info);
|
||||
weprintln!(initial_indent = " - ", "{}", info);
|
||||
}
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "usable {}", key.usable_for());
|
||||
weprintln!(initial_indent = " - ", "usable {}", key.usable_for());
|
||||
for loc in &key.locations {
|
||||
wprintln!(initial_indent = " - ", "{}", loc);
|
||||
weprintln!(initial_indent = " - ", "{}", loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,10 +158,10 @@ pub fn bind(sq: Sq, command: cli::key::subkey::bind::Command) -> Result<()>
|
||||
Ok((cert, key, builder)) => Some((cert, key, builder)),
|
||||
Err(err) => {
|
||||
if ! missing {
|
||||
wprintln!("Missing keys:");
|
||||
weprintln!("Missing keys:");
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}: {}", id, err);
|
||||
weprintln!(initial_indent = " - ", "{}: {}", id, err);
|
||||
|
||||
missing = true;
|
||||
None
|
||||
@ -281,7 +281,7 @@ pub fn bind(sq: Sq, command: cli::key::subkey::bind::Command) -> Result<()>
|
||||
}
|
||||
|
||||
if p == "".into() {
|
||||
wprintln!("Giving up.");
|
||||
weprintln!("Giving up.");
|
||||
return Err(anyhow::anyhow!(
|
||||
"Failed to unlock key: {}",
|
||||
err.expect("must be set when we came here")));
|
||||
@ -404,7 +404,7 @@ pub fn bind(sq: Sq, command: cli::key::subkey::bind::Command) -> Result<()>
|
||||
sq.import_cert(cert).err()
|
||||
};
|
||||
if let Some(err) = result {
|
||||
wprintln!("Error importing updated cert: {}", err);
|
||||
weprintln!("Error importing updated cert: {}", err);
|
||||
return Err(err);
|
||||
} else {
|
||||
sq.hint(format_args!(
|
||||
|
@ -66,7 +66,7 @@ pub fn dispatch(sq: Sq, command: crate::cli::key::subkey::export::Command)
|
||||
|
||||
if secret_keys.is_empty() {
|
||||
for (fpr, err) in errs.into_iter() {
|
||||
wprintln!("Exporting {}: {}", fpr, err);
|
||||
weprintln!("Exporting {}: {}", fpr, err);
|
||||
}
|
||||
return Err(anyhow::anyhow!(
|
||||
"Failed to export {}: no secret key material is available",
|
||||
|
@ -467,7 +467,7 @@ fn merge(sq: &Sq, inputs: Vec<PathBuf>, output: FileOrStdout,
|
||||
}
|
||||
|
||||
if let Some((_sig, name, err)) = bad {
|
||||
wprintln!("Could not add revocation certificate from {} \
|
||||
weprintln!("Could not add revocation certificate from {} \
|
||||
to certificate: {}",
|
||||
name, err);
|
||||
die = true;
|
||||
@ -480,14 +480,14 @@ fn merge(sq: &Sq, inputs: Vec<PathBuf>, output: FileOrStdout,
|
||||
match missing.as_slice() {
|
||||
[] => (),
|
||||
[(issuer, name)] => {
|
||||
wprintln!("Couldn't merge revocation certificate \
|
||||
weprintln!("Couldn't merge revocation certificate \
|
||||
from {}: missing {}.",
|
||||
name, issuer);
|
||||
}
|
||||
_ => {
|
||||
wprintln!("Couldn't some merge revocation certificates:");
|
||||
weprintln!("Couldn't some merge revocation certificates:");
|
||||
for (issuer, name) in missing.into_iter() {
|
||||
wprintln!(" - {}: missing {}",
|
||||
weprintln!(" - {}: missing {}",
|
||||
name, issuer);
|
||||
}
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ impl Method {
|
||||
Some((cert, created)) => (cert, created),
|
||||
None => {
|
||||
if sq.verbose() {
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
"Not recording provenance information: \
|
||||
{} is not known to be a verifying \
|
||||
keyserver",
|
||||
@ -608,7 +608,7 @@ impl Method {
|
||||
Ok(None) => return None,
|
||||
Err(err) => {
|
||||
let print_err = || {
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
"Not recording provenance information: {}",
|
||||
err);
|
||||
};
|
||||
@ -633,7 +633,7 @@ impl Method {
|
||||
if sq.verbose() {
|
||||
let invalid = "invalid data".to_string();
|
||||
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
"Created the local CA {} for certifying \
|
||||
certificates downloaded from this service. \
|
||||
Use `sq pki link authorize --unconstrained --amount N {}` \
|
||||
@ -765,7 +765,7 @@ impl Response {
|
||||
|
||||
if ! silent_errors || sq.verbose() || certs.is_empty() {
|
||||
for (method, query, e) in errors {
|
||||
pb.suspend(|| wprintln!("{}: {}: {}", method, query, e));
|
||||
pb.suspend(|| weprintln!("{}: {}: {}", method, query, e));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1167,7 +1167,7 @@ pub fn dispatch_keyserver(
|
||||
// an error, and only print the message in
|
||||
// verbose mode.
|
||||
if sq.verbose() {
|
||||
wprintln!("{}: {}", url, e);
|
||||
weprintln!("{}: {}", url, e);
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
@ -1187,7 +1187,7 @@ pub fn dispatch_keyserver(
|
||||
encryption-capable."));
|
||||
}
|
||||
|
||||
wprintln!("{}: {}", url, e);
|
||||
weprintln!("{}: {}", url, e);
|
||||
if result.is_ok() {
|
||||
result = Err((url, e));
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ pub fn dispatch(sq: Sq, command: Command)
|
||||
if let Some(path) = command.input.inner() {
|
||||
if ! path.exists() &&
|
||||
format!("{}", command.input).parse::<KeyHandle>().is_ok() {
|
||||
wprintln!("The file {} does not exist, \
|
||||
weprintln!("The file {} does not exist, \
|
||||
did you mean \"sq packet dump \
|
||||
--cert {}\"?",
|
||||
--cert-file {}\"?",
|
||||
path.display(), path.display());
|
||||
}
|
||||
}
|
||||
|
@ -203,19 +203,19 @@ pub fn list(sq: Sq, c: link::ListCommand)
|
||||
}
|
||||
|
||||
if dirty {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
dirty = true;
|
||||
|
||||
wprintln!(initial_indent=" - ┌ ", subsequent_indent=" │ ",
|
||||
weprintln!(initial_indent=" - ┌ ", subsequent_indent=" │ ",
|
||||
"{}", cert.fingerprint());
|
||||
wprintln!(initial_indent=" └ ",
|
||||
weprintln!(initial_indent=" └ ",
|
||||
"{:?}", String::from_utf8_lossy(userid.value()));
|
||||
|
||||
const INDENT: &'static str = " - ";
|
||||
|
||||
if amount == 0 {
|
||||
wprintln!(initial_indent=INDENT, "link was retracted");
|
||||
weprintln!(initial_indent=INDENT, "link was retracted");
|
||||
} else {
|
||||
let mut regex: Vec<_> = certification.regular_expressions()
|
||||
.map(|re| String::from_utf8_lossy(re))
|
||||
@ -234,27 +234,27 @@ pub fn list(sq: Sq, c: link::ListCommand)
|
||||
} else {
|
||||
"is linked"
|
||||
};
|
||||
wprintln!(initial_indent=INDENT, "{}", summary);
|
||||
weprintln!(initial_indent=INDENT, "{}", summary);
|
||||
|
||||
if let Some(e) = certification.signature_expiration_time() {
|
||||
wprintln!(initial_indent=INDENT,
|
||||
weprintln!(initial_indent=INDENT,
|
||||
"expiration: {}",
|
||||
chrono::DateTime::<chrono::Utc>::from(e)
|
||||
.format("%Y‑%m‑%d"));
|
||||
}
|
||||
|
||||
if depth != 0 && depth != 255 {
|
||||
wprintln!(initial_indent=INDENT,
|
||||
weprintln!(initial_indent=INDENT,
|
||||
"trust depth: {}", depth);
|
||||
}
|
||||
|
||||
if amount != sequoia_wot::FULLY_TRUSTED as u8 {
|
||||
wprintln!(initial_indent=INDENT,
|
||||
weprintln!(initial_indent=INDENT,
|
||||
"trust amount: {}", amount);
|
||||
}
|
||||
|
||||
if ! regex.is_empty() {
|
||||
wprintln!(initial_indent=INDENT,
|
||||
weprintln!(initial_indent=INDENT,
|
||||
"regular expressions: {}", regex.join("; "));
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ pub fn dispatch(sq: Sq, command: cli::verify::Command)
|
||||
if result.is_err() {
|
||||
if let Some(path) = command.output.path() {
|
||||
if let Err(err) = std::fs::remove_file(path) {
|
||||
wprintln!("Verification failed, failed to remove \
|
||||
weprintln!("Verification failed, failed to remove \
|
||||
unverified output saved to {}: {}",
|
||||
path.display(), err);
|
||||
}
|
||||
@ -177,7 +177,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
p(&mut status, "bad key", 1, self.broken_keys);
|
||||
p(&mut status, "broken signatures", 1, self.broken_signatures);
|
||||
if ! status.is_empty() {
|
||||
wprintln!("{}.", status);
|
||||
weprintln!("{}.", status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
let (sig, ka) = match result {
|
||||
Ok(GoodChecksum { sig, ka, .. }) => (sig, ka),
|
||||
Err(MalformedSignature { error, .. }) => {
|
||||
wprintln!("Malformed signature:");
|
||||
weprintln!("Malformed signature:");
|
||||
print_error_chain(error);
|
||||
self.broken_signatures += 1;
|
||||
continue;
|
||||
@ -206,7 +206,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
0 => "signature".into(),
|
||||
n => format!("level {} notarization", n),
|
||||
};
|
||||
wprintln!("Can't authenticate {} allegedly made by {}: \
|
||||
weprintln!("Can't authenticate {} allegedly made by {}: \
|
||||
missing certificate.",
|
||||
what, issuer);
|
||||
|
||||
@ -220,14 +220,14 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
continue;
|
||||
},
|
||||
Err(UnboundKey { cert, error, .. }) => {
|
||||
wprintln!("Signing key on {} is not bound:",
|
||||
weprintln!("Signing key on {} is not bound:",
|
||||
cert.fingerprint());
|
||||
print_error_chain(error);
|
||||
self.broken_keys += 1;
|
||||
continue;
|
||||
},
|
||||
Err(BadKey { ka, error, .. }) => {
|
||||
wprintln!("Signing key on {} is bad:",
|
||||
weprintln!("Signing key on {} is bad:",
|
||||
ka.cert().fingerprint());
|
||||
print_error_chain(error);
|
||||
self.broken_keys += 1;
|
||||
@ -239,7 +239,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
0 => "signature".into(),
|
||||
n => format!("level {} notarizing signature", n),
|
||||
};
|
||||
wprintln!("Error verifying {} made by {}:",
|
||||
weprintln!("Error verifying {} made by {}:",
|
||||
what, issuer);
|
||||
print_error_chain(error);
|
||||
self.bad_signatures += 1;
|
||||
@ -274,7 +274,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
cert_store.certified_userids_of(&cert_fpr);
|
||||
|
||||
if userids.is_empty() {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"{} cannot be authenticated. \
|
||||
It has no User IDs",
|
||||
cert_fpr);
|
||||
@ -294,7 +294,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
|
||||
let amount = paths.amount();
|
||||
let authenticated = if amount >= sequoia_wot::FULLY_TRUSTED {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"Fully authenticated \
|
||||
({} of {}) {}, {}",
|
||||
amount,
|
||||
@ -303,7 +303,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
userid_str);
|
||||
true
|
||||
} else if amount > 0 {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"Partially authenticated \
|
||||
({} of {}) {}, {:?} ",
|
||||
amount,
|
||||
@ -312,7 +312,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
userid_str);
|
||||
false
|
||||
} else {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"{}: {:?} is unauthenticated \
|
||||
and may be an impersonation!",
|
||||
cert_fpr,
|
||||
@ -380,18 +380,18 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
let level = sig.level();
|
||||
match (level == 0, authenticated) {
|
||||
(true, true) => {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"Authenticated signature made by {} ({:?})",
|
||||
label, signer_userid);
|
||||
}
|
||||
(false, true) => {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"Authenticated level {} notarization \
|
||||
made by {} ({:?})",
|
||||
level, label, signer_userid);
|
||||
}
|
||||
(true, false) => {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"Can't authenticate signature made by {} ({:?}): \
|
||||
the certificate can't be authenticated.",
|
||||
label, signer_userid);
|
||||
@ -406,7 +406,7 @@ impl<'c, 'store, 'rstore> VHelper<'c, 'store, 'rstore> {
|
||||
.done();
|
||||
}
|
||||
(false, false) => {
|
||||
wprintln!(indent=prefix,
|
||||
weprintln!(indent=prefix,
|
||||
"Can't authenticate level {} notarization \
|
||||
made by {} ({:?}): the certificate \
|
||||
can't be authenticated.",
|
||||
|
@ -9,9 +9,9 @@ use crate::{
|
||||
pub fn dispatch(_sq: Sq, _c: version::Command)
|
||||
-> Result<()>
|
||||
{
|
||||
wprintln!("sq {}", env!("CARGO_PKG_VERSION"));
|
||||
wprintln!("using sequoia-openpgp {}", sequoia_openpgp::VERSION);
|
||||
wprintln!("with cryptographic backend {}",
|
||||
weprintln!("sq {}", env!("CARGO_PKG_VERSION"));
|
||||
weprintln!("using sequoia-openpgp {}", sequoia_openpgp::VERSION);
|
||||
weprintln!("with cryptographic backend {}",
|
||||
sequoia_openpgp::crypto::backend());
|
||||
|
||||
Ok(())
|
||||
|
@ -57,7 +57,7 @@ where
|
||||
for ka in kas.into_iter() {
|
||||
let no_secret_key_material = ! ka.has_secret();
|
||||
if no_secret_key_material {
|
||||
wprintln!("{}{} does not contain any secret key material",
|
||||
weprintln!("{}{} does not contain any secret key material",
|
||||
warning, ka.fingerprint());
|
||||
no_secret_key_material_count += 1;
|
||||
continue;
|
||||
@ -75,7 +75,7 @@ where
|
||||
let no_secret_key_material = remote_keys.is_empty();
|
||||
|
||||
if no_secret_key_material {
|
||||
wprintln!("{}{} does not contain any secret key material",
|
||||
weprintln!("{}{} does not contain any secret key material",
|
||||
warning, ka.fingerprint());
|
||||
no_secret_key_material_count += 1;
|
||||
continue;
|
||||
|
@ -241,7 +241,7 @@ where P: cert_designator::ArgumentPrefix,
|
||||
|
||||
let fipr = cert.fingerprint();
|
||||
if let Err(err) = cert_store.update(Arc::new(cert.into())) {
|
||||
wprintln!("Error importing updated cert: {}", err);
|
||||
weprintln!("Error importing updated cert: {}", err);
|
||||
return Err(err);
|
||||
} else {
|
||||
sq.hint(format_args!(
|
||||
|
@ -83,7 +83,7 @@ where
|
||||
|
||||
if ! unlocked {
|
||||
if let Some(hint) = hint {
|
||||
wprintln!("{}", hint);
|
||||
weprintln!("{}", hint);
|
||||
}
|
||||
|
||||
let time = key.creation_time().convert().to_string();
|
||||
@ -125,7 +125,7 @@ where
|
||||
break;
|
||||
}
|
||||
Err(err) => {
|
||||
wprintln!("Failed to unlock key: {}", err);
|
||||
weprintln!("Failed to unlock key: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,16 +86,16 @@ fn prompt_for_new_internal(
|
||||
let password = prompt_password(sq, &p0)?;
|
||||
|
||||
if password.is_empty() && ! allow_none {
|
||||
wprintln!("Password required. Please try again.");
|
||||
wprintln!();
|
||||
weprintln!("Password required. Please try again.");
|
||||
weprintln!();
|
||||
continue;
|
||||
}
|
||||
|
||||
let password_repeat = prompt_password(sq, &p1)?;
|
||||
|
||||
if password != password_repeat {
|
||||
wprintln!("The passwords do not match. Please try again.");
|
||||
wprintln!();
|
||||
weprintln!("The passwords do not match. Please try again.");
|
||||
weprintln!();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -271,12 +271,12 @@ pub fn authenticate<'store, 'rstore>(
|
||||
|
||||
// Check if the certificate has expired.
|
||||
if let Err(err) = vc.alive() {
|
||||
wprintln!("Warning: {} is not live: {}.",
|
||||
weprintln!("Warning: {} is not live: {}.",
|
||||
cert.fingerprint(), err);
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
wprintln!("Warning: {} is not valid according to \
|
||||
weprintln!("Warning: {} is not valid according to \
|
||||
the current policy: {}.",
|
||||
cert.fingerprint(),
|
||||
crate::one_line_error_chain(err));
|
||||
@ -290,7 +290,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
if let Some((reason, message))
|
||||
= sigs[0].reason_for_revocation()
|
||||
{
|
||||
wprintln!("Warning: {} is revoked: {}{}",
|
||||
weprintln!("Warning: {} is revoked: {}{}",
|
||||
cert.fingerprint(),
|
||||
reason,
|
||||
if message.is_empty() {
|
||||
@ -300,7 +300,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
String::from_utf8_lossy(message))
|
||||
});
|
||||
} else {
|
||||
wprintln!("Warning: {} is revoked: unspecified reason",
|
||||
weprintln!("Warning: {} is revoked: unspecified reason",
|
||||
cert.fingerprint());
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
// See if there is a matching self-signed User ID.
|
||||
if let Some(userid) = userid {
|
||||
if ! have_self_signed_userid(cert, &UserID::from(userid), email) {
|
||||
wprintln!("Warning: {} is not a \
|
||||
weprintln!("Warning: {} is not a \
|
||||
self-signed User ID for {}.",
|
||||
userid, cert.fingerprint());
|
||||
}
|
||||
@ -324,7 +324,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
})
|
||||
})
|
||||
{
|
||||
wprintln!("Warning: {} has no valid certifications.",
|
||||
weprintln!("Warning: {} has no valid certifications.",
|
||||
cert.fingerprint());
|
||||
}
|
||||
}
|
||||
@ -338,7 +338,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
let userid_check = UserID::from(format!("<{}>", email));
|
||||
if let Ok(Some(email_check)) = userid_check.email2() {
|
||||
if userid == email_check {
|
||||
wprintln!("WARNING: {} appears to be a bare \
|
||||
weprintln!("WARNING: {} appears to be a bare \
|
||||
email address. Perhaps you forgot \
|
||||
to specify --email.",
|
||||
email);
|
||||
@ -352,7 +352,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
if n.roots().iter().all(|r| {
|
||||
let fpr = r.fingerprint();
|
||||
if let Err(err) = n.lookup_synopsis_by_fpr(&fpr) {
|
||||
wprintln!("Looking up trust root ({}): {}.",
|
||||
weprintln!("Looking up trust root ({}): {}.",
|
||||
fpr, err);
|
||||
true
|
||||
} else {
|
||||
@ -360,7 +360,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
}
|
||||
})
|
||||
{
|
||||
wprintln!("No trust roots found.");
|
||||
weprintln!("No trust roots found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -377,7 +377,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
// We are in gossip mode. Mention `sq pki link` as a way to
|
||||
// mark bindings as authenticated.
|
||||
if ! bindings.is_empty() {
|
||||
wprintln!("After checking that a user ID really belongs to \
|
||||
weprintln!("After checking that a user ID really belongs to \
|
||||
a certificate, use `sq pki link add` to mark \
|
||||
the binding as authenticated, or use \
|
||||
`sq network fetch FINGERPRINT|EMAIL` to look for \
|
||||
@ -387,7 +387,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
// There are no matching bindings. Tell the user about `sq
|
||||
// network fetch`.
|
||||
if let Some(pattern) = pattern() {
|
||||
wprintln!("No bindings match.");
|
||||
weprintln!("No bindings match.");
|
||||
|
||||
sq.hint(format_args!(
|
||||
"Try searching public directories:"))
|
||||
@ -395,7 +395,7 @@ pub fn authenticate<'store, 'rstore>(
|
||||
.arg(pattern)
|
||||
.done();
|
||||
} else {
|
||||
wprintln!("The certificate store does not contain any \
|
||||
weprintln!("The certificate store does not contain any \
|
||||
certificates.");
|
||||
|
||||
sq.hint(format_args!(
|
||||
@ -426,18 +426,18 @@ pub fn authenticate<'store, 'rstore>(
|
||||
let bindings_not_shown = bindings - bindings_shown;
|
||||
|
||||
if bindings == 1 {
|
||||
wprintln!("1 binding found.");
|
||||
weprintln!("1 binding found.");
|
||||
} else {
|
||||
wprintln!("{} bindings found.", bindings);
|
||||
weprintln!("{} bindings found.", bindings);
|
||||
}
|
||||
|
||||
if bindings_not_shown == 1 {
|
||||
wprintln!("Skipped 1 binding, which could not be authenticated.");
|
||||
wprintln!("Pass `--gossip` to see the unauthenticated binding.");
|
||||
weprintln!("Skipped 1 binding, which could not be authenticated.");
|
||||
weprintln!("Pass `--gossip` to see the unauthenticated binding.");
|
||||
} else {
|
||||
wprintln!("Skipped {} bindings, which could not be authenticated.",
|
||||
weprintln!("Skipped {} bindings, which could not be authenticated.",
|
||||
bindings_not_shown);
|
||||
wprintln!("Pass `--gossip` to see the unauthenticated bindings.");
|
||||
weprintln!("Pass `--gossip` to see the unauthenticated bindings.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ The certifier is the same as the certificate to certify."));
|
||||
|
||||
let fipr = cert.fingerprint();
|
||||
if let Err(err) = cert_store.update(Arc::new(cert.into())) {
|
||||
wprintln!("Error importing updated cert: {}", err);
|
||||
weprintln!("Error importing updated cert: {}", err);
|
||||
return Err(err);
|
||||
} else if ! local {
|
||||
sq.hint(format_args!(
|
||||
|
@ -33,7 +33,7 @@ use super::OutputType;
|
||||
|
||||
/// Prints a Path Error
|
||||
pub fn print_path_error(err: Error) {
|
||||
wprintln!(initial_indent = "└ ", "Checking path: {}", err);
|
||||
weprintln!(initial_indent = "└ ", "Checking path: {}", err);
|
||||
}
|
||||
|
||||
/// Prints information of a Path for a target UserID associated with a KeyHandle
|
||||
@ -43,7 +43,7 @@ pub fn print_path_header(
|
||||
amount: usize,
|
||||
required_amount: usize,
|
||||
) {
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
initial_indent="",
|
||||
subsequent_indent=" ",
|
||||
"[{}] {} {}: {} authenticated ({}%)",
|
||||
@ -74,10 +74,10 @@ pub fn print_path(path: &PathLints, target_userid: &UserID, prefix: &str)
|
||||
-> Result<()>
|
||||
{
|
||||
let certification_count = path.certifications().count();
|
||||
wprintln!(initial_indent=format!("{}◯─┬ ", prefix),
|
||||
weprintln!(initial_indent=format!("{}◯─┬ ", prefix),
|
||||
subsequent_indent=format!("{}│ │ ", prefix),
|
||||
"{}", path.root().key_handle());
|
||||
wprintln!(initial_indent=format!("{}│ └ ", prefix),
|
||||
weprintln!(initial_indent=format!("{}│ └ ", prefix),
|
||||
subsequent_indent=format!("{}│ ", prefix),
|
||||
"{}",
|
||||
if certification_count == 0 {
|
||||
@ -89,8 +89,8 @@ pub fn print_path(path: &PathLints, target_userid: &UserID, prefix: &str)
|
||||
});
|
||||
|
||||
if path.certifications().count() == 0 {
|
||||
wprintln!(indent=prefix, "│");
|
||||
wprintln!(initial_indent=format!("{}└── ", prefix),
|
||||
weprintln!(indent=prefix, "│");
|
||||
weprintln!(initial_indent=format!("{}└── ", prefix),
|
||||
subsequent_indent=format!("{} ", prefix),
|
||||
"Self-signed user ID.");
|
||||
return Ok(());
|
||||
@ -157,13 +157,13 @@ pub fn print_path(path: &PathLints, target_userid: &UserID, prefix: &str)
|
||||
write!(&mut line, " No adequate certification found.")?;
|
||||
}
|
||||
|
||||
wprintln!(indent=prefix, "│");
|
||||
wprintln!(indent=format!("{}│ ", prefix), "{}", line);
|
||||
wprintln!(indent=prefix, "│");
|
||||
weprintln!(indent=prefix, "│");
|
||||
weprintln!(indent=format!("{}│ ", prefix), "{}", line);
|
||||
weprintln!(indent=prefix, "│");
|
||||
|
||||
for err in cert.errors().iter().chain(cert.lints()) {
|
||||
for (i, msg) in error_chain(err).into_iter().enumerate() {
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
indent=format!(
|
||||
"{}│ {}", prefix, if i == 0 { "" } else { " " }),
|
||||
"{}", msg);
|
||||
@ -171,19 +171,19 @@ pub fn print_path(path: &PathLints, target_userid: &UserID, prefix: &str)
|
||||
}
|
||||
for err in certification.errors().iter().chain(certification.lints()) {
|
||||
for (i, msg) in error_chain(err).into_iter().enumerate() {
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
indent=format!(
|
||||
"{}│ {}", prefix, if i == 0 { "" } else { " " }),
|
||||
"{}", msg);
|
||||
}
|
||||
}
|
||||
|
||||
wprintln!(initial_indent=format!("{}{}─┬ ", prefix,
|
||||
weprintln!(initial_indent=format!("{}{}─┬ ", prefix,
|
||||
if last { "└" } else { "├" }),
|
||||
subsequent_indent=format!("{}{} │ ", prefix,
|
||||
if last { " " } else { "│" }),
|
||||
"{}", certification.target());
|
||||
wprintln!(initial_indent=format!("{}{} └ ", prefix,
|
||||
weprintln!(initial_indent=format!("{}{} └ ", prefix,
|
||||
if last { " " } else { "│" }),
|
||||
subsequent_indent=format!("{}{} ", prefix,
|
||||
if last { " " } else { "│" }),
|
||||
@ -202,7 +202,7 @@ pub fn print_path(path: &PathLints, target_userid: &UserID, prefix: &str)
|
||||
let target = path.certs().last().expect("have one");
|
||||
for err in target.errors().iter().chain(target.lints()) {
|
||||
for (i, msg) in error_chain(err).into_iter().enumerate() {
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
indent=format!(
|
||||
"{}│ {}", prefix, if i == 0 { "" } else { " " }),
|
||||
"{}", msg);
|
||||
@ -211,7 +211,7 @@ pub fn print_path(path: &PathLints, target_userid: &UserID, prefix: &str)
|
||||
}
|
||||
}
|
||||
|
||||
wprintln!("");
|
||||
weprintln!("");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -341,20 +341,20 @@ impl OutputType for ConciseHumanReadableOutputNetwork<'_, '_, '_> {
|
||||
}
|
||||
|
||||
if ! first_shown {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
|
||||
wprintln!(initial_indent = " - ", "{}", fingerprint);
|
||||
weprintln!(initial_indent = " - ", "{}", fingerprint);
|
||||
|
||||
if cert.primary_key().key().creation_time() != ca_creation_time() {
|
||||
wprintln!(initial_indent = " - ", "created {}",
|
||||
weprintln!(initial_indent = " - ", "created {}",
|
||||
cert.primary_key().key().creation_time().convert());
|
||||
}
|
||||
|
||||
for info in extra_info.into_iter() {
|
||||
wprintln!(initial_indent = " - ", "{}", info);
|
||||
weprintln!(initial_indent = " - ", "{}", info);
|
||||
}
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
|
||||
let revoked = if let Some(Ok(ref vc)) = vc {
|
||||
@ -375,7 +375,7 @@ impl OutputType for ConciseHumanReadableOutputNetwork<'_, '_, '_> {
|
||||
None
|
||||
};
|
||||
|
||||
wprintln!(initial_indent = " - ", "[ {} ] {}",
|
||||
weprintln!(initial_indent = " - ", "[ {} ] {}",
|
||||
if revoked.is_some() {
|
||||
"revoked".to_string()
|
||||
} else if aggregated_amount >= self.required_amount {
|
||||
@ -386,11 +386,11 @@ impl OutputType for ConciseHumanReadableOutputNetwork<'_, '_, '_> {
|
||||
String::from_utf8_lossy(userid.value()));
|
||||
|
||||
if self.paths {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
|
||||
for (i, (path, amount)) in paths.iter().enumerate() {
|
||||
if paths.len() > 1 {
|
||||
wprintln!(
|
||||
weprintln!(
|
||||
initial_indent=" ",
|
||||
"Path #{}{}of{}{}, trust amount {}:",
|
||||
i + 1, NBSP, NBSP,
|
||||
|
@ -121,7 +121,7 @@ where
|
||||
}
|
||||
userids.push(designator.resolve_to(userid));
|
||||
} else {
|
||||
wprintln!("{:?} is not a self-signed user ID.",
|
||||
weprintln!("{:?} is not a self-signed user ID.",
|
||||
String::from_utf8_lossy(userid.value()));
|
||||
missing = true;
|
||||
}
|
||||
@ -134,7 +134,7 @@ where
|
||||
let userid = match UserID::from_address(None, None, email) {
|
||||
Ok(userid) => userid,
|
||||
Err(err) => {
|
||||
wprintln!("{:?} is not a valid email address: {}",
|
||||
weprintln!("{:?} is not a valid email address: {}",
|
||||
email, err);
|
||||
bad = Some(err);
|
||||
continue;
|
||||
@ -146,13 +146,13 @@ where
|
||||
let email_normalized = match userid.email_normalized() {
|
||||
Ok(Some(email)) => email,
|
||||
Ok(None) => {
|
||||
wprintln!("{:?} is not a valid email address", email);
|
||||
weprintln!("{:?} is not a valid email address", email);
|
||||
bad = Some(anyhow::anyhow!(format!(
|
||||
"{:?} is not a valid email address", email)));
|
||||
continue;
|
||||
}
|
||||
Err(err) => {
|
||||
wprintln!("{:?} is not a valid email address: {}",
|
||||
weprintln!("{:?} is not a valid email address: {}",
|
||||
email, err);
|
||||
bad = Some(err);
|
||||
continue;
|
||||
@ -166,7 +166,7 @@ where
|
||||
== ua.email_normalized().unwrap_or(None).as_ref()
|
||||
{
|
||||
if found {
|
||||
wprintln!("{} is ambiguous: it matches \
|
||||
weprintln!("{} is ambiguous: it matches \
|
||||
multiple self-signed user IDs.",
|
||||
email);
|
||||
ambiguous_email = true;
|
||||
@ -203,7 +203,7 @@ where
|
||||
if userid.name2().ok() != Some(Some(&name[..])) {
|
||||
let err = format!("{:?} is not a valid display name",
|
||||
name);
|
||||
wprintln!("{}", err);
|
||||
weprintln!("{}", err);
|
||||
bad = Some(anyhow::anyhow!(err));
|
||||
continue;
|
||||
};
|
||||
@ -213,7 +213,7 @@ where
|
||||
if let Ok(Some(n)) = ua.userid().name2() {
|
||||
if n == name {
|
||||
if found {
|
||||
wprintln!("{:?} is ambiguous: it matches \
|
||||
weprintln!("{:?} is ambiguous: it matches \
|
||||
multiple self-signed user IDs.",
|
||||
name);
|
||||
ambiguous_name = true;
|
||||
@ -247,23 +247,23 @@ where
|
||||
}
|
||||
|
||||
if missing || ambiguous_email || ambiguous_name {
|
||||
wprintln!("{}'s self-signed user IDs:", vc.fingerprint());
|
||||
weprintln!("{}'s self-signed user IDs:", vc.fingerprint());
|
||||
let mut have_valid = false;
|
||||
for ua in vc.userids() {
|
||||
if let Ok(u) = std::str::from_utf8(ua.userid().value()) {
|
||||
have_valid = true;
|
||||
wprintln!(initial_indent=" - ",
|
||||
weprintln!(initial_indent=" - ",
|
||||
subsequent_indent=" ",
|
||||
"{:?}", u);
|
||||
}
|
||||
}
|
||||
if ! have_valid {
|
||||
wprintln!(" - Certificate has no valid self-signed user IDs.");
|
||||
weprintln!(" - Certificate has no valid self-signed user IDs.");
|
||||
}
|
||||
|
||||
if let Ok(null) = vc.clone().with_policy(&NULL_POLICY, vc.time()) {
|
||||
if vc.userids().count() < null.userids().count() {
|
||||
wprintln!("Invalid self-signed user IDs:");
|
||||
weprintln!("Invalid self-signed user IDs:");
|
||||
let valid: BTreeSet<_>
|
||||
= vc.userids().map(|ua| ua.userid().clone()).collect();
|
||||
for ua in null.userids() {
|
||||
@ -273,7 +273,7 @@ where
|
||||
|
||||
if let Ok(u) = std::str::from_utf8(ua.userid().value()) {
|
||||
if let Err(err) = ua.with_policy(vc.policy(), vc.time()) {
|
||||
wprintln!(initial_indent=" - ",
|
||||
weprintln!(initial_indent=" - ",
|
||||
subsequent_indent=" ",
|
||||
"{:?}: {}", u, err);
|
||||
}
|
||||
@ -285,21 +285,21 @@ where
|
||||
|
||||
if missing {
|
||||
if add_userid_arg && add_email_arg {
|
||||
wprintln!("Use `--userid-or-add` or `--email-or-add` to use \
|
||||
weprintln!("Use `--userid-or-add` or `--email-or-add` to use \
|
||||
a user ID even if it isn't self signed, or has \
|
||||
an invalid self signature.");
|
||||
}
|
||||
return Err(anyhow::anyhow!("No matching self-signed user ID"));
|
||||
}
|
||||
if ambiguous_email {
|
||||
wprintln!("Use `--userid` with the full user ID, or \
|
||||
weprintln!("Use `--userid` with the full user ID, or \
|
||||
`--userid-or-add` to add a new user ID.");
|
||||
return Err(anyhow::anyhow!("\
|
||||
An email address does not unambiguously designate a \
|
||||
self-signed user ID"));
|
||||
}
|
||||
if ambiguous_name {
|
||||
wprintln!("Use `--userid` with the full user ID, or \
|
||||
weprintln!("Use `--userid` with the full user ID, or \
|
||||
`--userid-or-add` to add a new user ID.");
|
||||
return Err(anyhow::anyhow!("\
|
||||
A name does not unambiguously designate a \
|
||||
|
@ -140,15 +140,15 @@ pub(crate) fn lint_userids(uids: &[UserID]) -> Result<(), anyhow::Error> {
|
||||
Ok(())
|
||||
} else {
|
||||
if non_canonical.len() == 1 {
|
||||
wprintln!("{}.", non_canonical[0]);
|
||||
wprintln!();
|
||||
weprintln!("{}.", non_canonical[0]);
|
||||
weprintln!();
|
||||
} else {
|
||||
wprintln!("The following user IDs are not in canonical form:");
|
||||
wprintln!();
|
||||
weprintln!("The following user IDs are not in canonical form:");
|
||||
weprintln!();
|
||||
for err in non_canonical.iter() {
|
||||
wprintln!(initial_indent = " - ", "{}", err);
|
||||
weprintln!(initial_indent = " - ", "{}", err);
|
||||
}
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
|
||||
let bare_email = non_canonical.iter()
|
||||
@ -161,7 +161,7 @@ pub(crate) fn lint_userids(uids: &[UserID]) -> Result<(), anyhow::Error> {
|
||||
})
|
||||
.next();
|
||||
|
||||
wprintln!("Canonical user IDs are of the form \
|
||||
weprintln!("Canonical user IDs are of the form \
|
||||
`Name <localpart@example.org>`. {}\
|
||||
Consider fixing the user IDs or passing \
|
||||
`--allow-non-canonical-userids`.",
|
||||
@ -172,7 +172,7 @@ pub(crate) fn lint_userids(uids: &[UserID]) -> Result<(), anyhow::Error> {
|
||||
} else {
|
||||
"".to_string()
|
||||
});
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
|
||||
Err(anyhow::anyhow!("\
|
||||
Some user IDs are not in canonical form"))
|
||||
@ -223,15 +223,15 @@ pub fn lint_names(names: &[String]) -> Result<(), anyhow::Error> {
|
||||
Ok(())
|
||||
} else {
|
||||
if non_canonical.len() == 1 {
|
||||
wprintln!("{}.", non_canonical[0]);
|
||||
wprintln!();
|
||||
weprintln!("{}.", non_canonical[0]);
|
||||
weprintln!();
|
||||
} else {
|
||||
wprintln!("The following names have issues:");
|
||||
wprintln!();
|
||||
weprintln!("The following names have issues:");
|
||||
weprintln!();
|
||||
for err in non_canonical.iter() {
|
||||
wprintln!(initial_indent = " - ", "{}", err);
|
||||
weprintln!(initial_indent = " - ", "{}", err);
|
||||
}
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
|
||||
Err(anyhow::anyhow!("Some names had issues"))
|
||||
@ -282,15 +282,15 @@ pub fn lint_emails(emails: &[String]) -> Result<(), anyhow::Error> {
|
||||
Ok(())
|
||||
} else {
|
||||
if non_canonical.len() == 1 {
|
||||
wprintln!("{}.", non_canonical[0]);
|
||||
wprintln!();
|
||||
weprintln!("{}.", non_canonical[0]);
|
||||
weprintln!();
|
||||
} else {
|
||||
wprintln!("The following email addresses have issues:");
|
||||
wprintln!();
|
||||
weprintln!("The following email addresses have issues:");
|
||||
weprintln!();
|
||||
for err in non_canonical.iter() {
|
||||
wprintln!(initial_indent = " - ", "{}", err);
|
||||
weprintln!(initial_indent = " - ", "{}", err);
|
||||
}
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
|
||||
Err(anyhow::anyhow!("Some email addresses had issues"))
|
||||
|
@ -14,14 +14,14 @@ macro_rules! platform {
|
||||
}
|
||||
|
||||
/// Like eprintln, but nicely wraps lines.
|
||||
macro_rules! wprintln {
|
||||
macro_rules! weprintln {
|
||||
{} => {
|
||||
eprintln!();
|
||||
};
|
||||
|
||||
{ indent=$i: expr, $($arg: expr),* } => {{
|
||||
let i = $i;
|
||||
crate::output::wrapping::iwprintln(i.as_ref(), i.as_ref(),
|
||||
crate::output::wrapping::iweprintln(i.as_ref(), i.as_ref(),
|
||||
format_args!($($arg),*))
|
||||
}};
|
||||
|
||||
@ -32,7 +32,7 @@ macro_rules! wprintln {
|
||||
} => {{
|
||||
let ii = $ii;
|
||||
let si = $si;
|
||||
crate::output::wrapping::iwprintln(ii.as_ref(), si.as_ref(),
|
||||
crate::output::wrapping::iweprintln(ii.as_ref(), si.as_ref(),
|
||||
format_args!($($arg),*))
|
||||
}};
|
||||
|
||||
@ -42,16 +42,16 @@ macro_rules! wprintln {
|
||||
} => {{
|
||||
let ii = $ii;
|
||||
let si = format!("{:1$}", "", ii.len());
|
||||
crate::output::wrapping::iwprintln(ii.as_ref(), si.as_ref(),
|
||||
crate::output::wrapping::iweprintln(ii.as_ref(), si.as_ref(),
|
||||
format_args!($($arg),*))
|
||||
}};
|
||||
|
||||
{ $($arg: expr),* } => {
|
||||
crate::output::wrapping::wprintln(format_args!($($arg),*))
|
||||
crate::output::wrapping::weprintln(format_args!($($arg),*))
|
||||
};
|
||||
}
|
||||
|
||||
/// Like wprintln, but doesn't emit anything in quiet mode.
|
||||
/// Like weprintln, but doesn't emit anything in quiet mode.
|
||||
macro_rules! make_qprintln {
|
||||
($quiet: expr) => {
|
||||
macro_rules! qprintln {
|
||||
@ -62,167 +62,167 @@ macro_rules! make_qprintln {
|
||||
// First, with `indent`.
|
||||
{ indent=$i: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i);
|
||||
weprintln!(indent=$i);
|
||||
}
|
||||
};
|
||||
{ indent=$i: expr, $a0: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i, $a0);
|
||||
weprintln!(indent=$i, $a0);
|
||||
}
|
||||
};
|
||||
{ indent=$i: expr, $a0: expr, $a1: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i, $a0, $a1);
|
||||
weprintln!(indent=$i, $a0, $a1);
|
||||
}
|
||||
};
|
||||
{ indent=$i: expr, $a0: expr, $a1: expr, $a2: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i, $a0, $a1, $a2);
|
||||
weprintln!(indent=$i, $a0, $a1, $a2);
|
||||
}
|
||||
};
|
||||
{ indent=$i: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i, $a0, $a1, $a2, $a3);
|
||||
weprintln!(indent=$i, $a0, $a1, $a2, $a3);
|
||||
}
|
||||
};
|
||||
{ indent=$i: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i, $a0, $a1, $a2, $a3, $a4);
|
||||
weprintln!(indent=$i, $a0, $a1, $a2, $a3, $a4);
|
||||
}
|
||||
};
|
||||
{ indent=$i: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i, $a0, $a1, $a2, $a3, $a4, $a5);
|
||||
weprintln!(indent=$i, $a0, $a1, $a2, $a3, $a4, $a5);
|
||||
}
|
||||
};
|
||||
{ indent=$i: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr, $a6: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(indent=$i, $a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
weprintln!(indent=$i, $a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
}
|
||||
};
|
||||
// Again, with `initial_indent` and `subsequent_indent`.
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr, $a0: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si, $a0);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si, $a0);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr, $a0: expr, $a1: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr, $a0: expr, $a1: expr, $a2: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3, $a4);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3, $a4);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3, $a4, $a5);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3, $a4, $a5);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, subsequent_indent=$si: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr, $a6: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
weprintln!(initial_indent=$ii, subsequent_indent=$si, $a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
}
|
||||
};
|
||||
|
||||
// Again, with `initial_indent`.
|
||||
{ initial_indent=$ii: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii);
|
||||
weprintln!(initial_indent=$ii);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, $a0: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, $a0);
|
||||
weprintln!(initial_indent=$ii, $a0);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, $a0: expr, $a1: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, $a0, $a1);
|
||||
weprintln!(initial_indent=$ii, $a0, $a1);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, $a0: expr, $a1: expr, $a2: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, $a0, $a1, $a2);
|
||||
weprintln!(initial_indent=$ii, $a0, $a1, $a2);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3);
|
||||
weprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3, $a4);
|
||||
weprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3, $a4);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3, $a4, $a5);
|
||||
weprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3, $a4, $a5);
|
||||
}
|
||||
};
|
||||
{ initial_indent=$ii: expr, $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr, $a6: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
weprintln!(initial_indent=$ii, $a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
}
|
||||
};
|
||||
|
||||
// Again, without any indent.
|
||||
{} => {
|
||||
if ! $quiet {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
}
|
||||
};
|
||||
{ $a0: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!($a0);
|
||||
weprintln!($a0);
|
||||
}
|
||||
};
|
||||
{ $a0: expr, $a1: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!($a0, $a1);
|
||||
weprintln!($a0, $a1);
|
||||
}
|
||||
};
|
||||
{ $a0: expr, $a1: expr, $a2: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!($a0, $a1, $a2);
|
||||
weprintln!($a0, $a1, $a2);
|
||||
}
|
||||
};
|
||||
{ $a0: expr, $a1: expr, $a2: expr, $a3: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!($a0, $a1, $a2, $a3);
|
||||
weprintln!($a0, $a1, $a2, $a3);
|
||||
}
|
||||
};
|
||||
{ $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!($a0, $a1, $a2, $a3, $a4);
|
||||
weprintln!($a0, $a1, $a2, $a3, $a4);
|
||||
}
|
||||
};
|
||||
{ $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!($a0, $a1, $a2, $a3, $a4, $a5);
|
||||
weprintln!($a0, $a1, $a2, $a3, $a4, $a5);
|
||||
}
|
||||
};
|
||||
{ $a0: expr, $a1: expr, $a2: expr, $a3: expr, $a4: expr, $a5: expr, $a6: expr } => {
|
||||
if ! $quiet {
|
||||
wprintln!($a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
weprintln!($a0, $a1, $a2, $a3, $a4, $a5, $a6);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
12
src/main.rs
12
src/main.rs
@ -130,7 +130,7 @@ where
|
||||
#[allow(dead_code)]
|
||||
fn help_warning(arg: &str) {
|
||||
if arg == "help" {
|
||||
wprintln!("Warning: \"help\" is not a subcommand here. \
|
||||
weprintln!("Warning: \"help\" is not a subcommand here. \
|
||||
Did you mean --help?");
|
||||
}
|
||||
}
|
||||
@ -396,7 +396,7 @@ fn real_main() -> Result<()> {
|
||||
err.print()?;
|
||||
|
||||
if let Some(examples) = command.get_after_help() {
|
||||
wprintln!("\n{}", examples);
|
||||
weprintln!("\n{}", examples);
|
||||
}
|
||||
} else {
|
||||
// Ummm... something went wrong: we should be able
|
||||
@ -476,10 +476,10 @@ fn error_chain(err: &anyhow::Error) -> Vec<String> {
|
||||
|
||||
/// Prints the error and causes, if any.
|
||||
pub fn print_error_chain(err: &anyhow::Error) {
|
||||
wprintln!();
|
||||
wprintln!(initial_indent=" Error: ", "{}", err);
|
||||
weprintln!();
|
||||
weprintln!(initial_indent=" Error: ", "{}", err);
|
||||
err.chain().skip(1).for_each(
|
||||
|cause| wprintln!(initial_indent="because: ", "{}", cause));
|
||||
|cause| weprintln!(initial_indent="because: ", "{}", cause));
|
||||
}
|
||||
|
||||
/// Returns the error chain as a string.
|
||||
@ -560,7 +560,7 @@ fn print_examples(cli: &clap::Command, usage: impl ToString) -> Result<()> {
|
||||
|
||||
// And print the examples, if any.
|
||||
if let Some(examples) = cmd.get_after_help() {
|
||||
wprintln!("\n{}", examples);
|
||||
weprintln!("\n{}", examples);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -27,8 +27,8 @@ impl Hint {
|
||||
/// follows.
|
||||
pub fn hint(mut self, msg: fmt::Arguments) -> Self {
|
||||
if ! self.quiet {
|
||||
wprintln!();
|
||||
wprintln!(
|
||||
weprintln!();
|
||||
weprintln!(
|
||||
initial_indent=if self.first { "Hint: " } else { " " },
|
||||
subsequent_indent=" ",
|
||||
"{}", msg);
|
||||
|
@ -70,7 +70,7 @@ impl ImportStats {
|
||||
self.keys.print_summary()?;
|
||||
}
|
||||
|
||||
wprintln!("Imported {}, updated {}, {} unchanged, {}.",
|
||||
weprintln!("Imported {}, updated {}, {} unchanged, {}.",
|
||||
self.certs.new_certs().of("new certificate"),
|
||||
self.certs.updated_certs().of("certificate"),
|
||||
self.certs.unchanged_certs().of("certificate"),
|
||||
@ -115,7 +115,7 @@ impl KeyStats {
|
||||
|
||||
/// Print key and certificate import summary.
|
||||
pub fn print_summary(&self) -> Result<()> {
|
||||
wprintln!("Imported {}, updated {}, {} unchanged, {}.",
|
||||
weprintln!("Imported {}, updated {}, {} unchanged, {}.",
|
||||
self.new.of("new key"),
|
||||
self.updated.of("key"),
|
||||
self.unchanged.of("key"),
|
||||
|
@ -8,9 +8,9 @@ pub const NBSP: char = '\u{00A0}';
|
||||
|
||||
/// Prints the given message to stderr.
|
||||
///
|
||||
/// Hint: Use `wprintln!(..)` instead of invoking this function
|
||||
/// Hint: Use `weprintln!(..)` instead of invoking this function
|
||||
/// directly.
|
||||
pub fn wprintln(msg: fmt::Arguments) {
|
||||
pub fn weprintln(msg: fmt::Arguments) {
|
||||
let m = format!("{}", msg);
|
||||
for l in textwrap::wrap(&m, options()) {
|
||||
eprintln!("{}", l);
|
||||
@ -19,10 +19,10 @@ pub fn wprintln(msg: fmt::Arguments) {
|
||||
|
||||
/// Prints the given message to stderr, indenting continuations.
|
||||
///
|
||||
/// Hint: Use `wprintln!(indent="...", ..)` or
|
||||
/// `wprintln!(initial_indent="...", subsequent_indent="...", ..)`
|
||||
/// Hint: Use `weprintln!(indent="...", ..)` or
|
||||
/// `weprintln!(initial_indent="...", subsequent_indent="...", ..)`
|
||||
/// instead of invoking this function directly.
|
||||
pub fn iwprintln(initial_indent: &str,
|
||||
pub fn iweprintln(initial_indent: &str,
|
||||
subsequent_indent: &str,
|
||||
msg: fmt::Arguments) {
|
||||
let m = format!("{}", msg);
|
||||
|
50
src/sq.rs
50
src/sq.rs
@ -578,11 +578,11 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
}
|
||||
|
||||
if checked_id {
|
||||
wprintln!("Error: {} does not have a key with \
|
||||
weprintln!("Error: {} does not have a key with \
|
||||
the required capabilities ({:?})",
|
||||
cert.keyid(), keyflags);
|
||||
} else {
|
||||
wprintln!("Error: The subkey {} (cert: {}) \
|
||||
weprintln!("Error: The subkey {} (cert: {}) \
|
||||
does not the required capabilities \
|
||||
({:?})",
|
||||
kh, cert.keyid(), keyflags);
|
||||
@ -683,7 +683,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
for userid in userid.iter() {
|
||||
let matches: Vec<(Fingerprint, UserID)> = if email {
|
||||
if let Err(err) = UserIDQueryParams::is_email(userid) {
|
||||
wprintln!("{:?} is not a valid email address", userid);
|
||||
weprintln!("{:?} is not a valid email address", userid);
|
||||
if error.is_none() {
|
||||
error = Some(err);
|
||||
}
|
||||
@ -834,14 +834,14 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
}
|
||||
};
|
||||
|
||||
wprintln!("{:?}:\n", err);
|
||||
weprintln!("{:?}:\n", err);
|
||||
if error.is_none() {
|
||||
error = Some(err);
|
||||
}
|
||||
|
||||
// Print the errors.
|
||||
for (i, Entry { fpr, userid, cert }) in bad.into_iter().enumerate() {
|
||||
wprintln!("{}. When considering {} ({}):",
|
||||
weprintln!("{}. When considering {} ({}):",
|
||||
i + 1, fpr,
|
||||
String::from_utf8_lossy(userid.value()));
|
||||
let err = match cert {
|
||||
@ -888,7 +888,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
// Not found.
|
||||
Ok(None) => None,
|
||||
Err(err) => {
|
||||
wprintln!("Error looking up local trust root: {}",
|
||||
weprintln!("Error looking up local trust root: {}",
|
||||
err);
|
||||
None
|
||||
}
|
||||
@ -900,20 +900,20 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
match parser.next() {
|
||||
Some(Ok(cert)) => Some(cert.fingerprint()),
|
||||
Some(Err(err)) => {
|
||||
wprintln!("Local trust root is \
|
||||
weprintln!("Local trust root is \
|
||||
corrupted: {}",
|
||||
err);
|
||||
None
|
||||
}
|
||||
None => {
|
||||
wprintln!("Local trust root is \
|
||||
weprintln!("Local trust root is \
|
||||
corrupted: no data");
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
wprintln!("Error parsing local trust root: {}",
|
||||
weprintln!("Error parsing local trust root: {}",
|
||||
err);
|
||||
None
|
||||
}
|
||||
@ -1262,10 +1262,10 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
return Ok(key);
|
||||
}
|
||||
|
||||
wprintln!("Incorrect password.");
|
||||
weprintln!("Incorrect password.");
|
||||
}
|
||||
Err(err) => {
|
||||
wprintln!("While reading password: {}", err);
|
||||
weprintln!("While reading password: {}", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1388,7 +1388,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
.is_none()
|
||||
{
|
||||
if let Some(hint) = hint {
|
||||
wprintln!("{}", hint);
|
||||
weprintln!("{}", hint);
|
||||
}
|
||||
|
||||
loop {
|
||||
@ -1397,7 +1397,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
ka.cert().keyid(), ka.keyid(), uid))?;
|
||||
|
||||
if p == "".into() {
|
||||
wprintln!("Giving up.");
|
||||
weprintln!("Giving up.");
|
||||
continue 'key;
|
||||
}
|
||||
|
||||
@ -1407,7 +1407,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
break;
|
||||
}
|
||||
Err(err) => {
|
||||
wprintln!("Failed to unlock key: {}", err);
|
||||
weprintln!("Failed to unlock key: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1735,7 +1735,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
/// Prints additional information in verbose mode.
|
||||
pub fn info(&self, msg: fmt::Arguments) {
|
||||
if self.verbose() {
|
||||
wprintln!("{}", msg);
|
||||
weprintln!("{}", msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2284,7 +2284,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
let (certs, errors) =
|
||||
self.resolve_certs(designators, trust_amount)?;
|
||||
if certs.len() > 1 {
|
||||
wprintln!("{} is ambiguous. It resolves to multiple certificates.",
|
||||
weprintln!("{} is ambiguous. It resolves to multiple certificates.",
|
||||
designators.designators[0].argument::<Prefix>());
|
||||
for cert in certs.iter() {
|
||||
eprintln!(" - {} {}",
|
||||
@ -2354,7 +2354,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
let err = format!(
|
||||
"Selected key {} is a primary key, not a subkey.",
|
||||
ka.fingerprint());
|
||||
wprintln!("{}", err);
|
||||
weprintln!("{}", err);
|
||||
bad.push(anyhow::anyhow!(err));
|
||||
continue;
|
||||
}
|
||||
@ -2384,7 +2384,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
let err = anyhow::anyhow!(
|
||||
"Can't use {}, it is hard revoked",
|
||||
ka.fingerprint());
|
||||
wprintln!("{}", err);
|
||||
weprintln!("{}", err);
|
||||
bad.push(err);
|
||||
} else {
|
||||
// Looks good!
|
||||
@ -2404,7 +2404,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
Err(err) => err,
|
||||
};
|
||||
|
||||
wprintln!("Selected key {} is unusable: {}.",
|
||||
weprintln!("Selected key {} is unusable: {}.",
|
||||
fingerprint, err);
|
||||
|
||||
bad.push(err);
|
||||
@ -2435,7 +2435,7 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
.done();
|
||||
} else {
|
||||
// The key isn't bound to the certificate at all.
|
||||
wprintln!("Selected key {} is not part of the certificate.",
|
||||
weprintln!("Selected key {} is not part of the certificate.",
|
||||
kh);
|
||||
missing.push(kh);
|
||||
}
|
||||
@ -2446,15 +2446,15 @@ impl<'store: 'rstore, 'rstore> Sq<'store, 'rstore> {
|
||||
keys.len(), kas.len(), missing.len(), bad.len());
|
||||
|
||||
if ! missing.is_empty() {
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
if only_subkeys {
|
||||
wprintln!("{} has the following subkeys:", vc.fingerprint());
|
||||
weprintln!("{} has the following subkeys:", vc.fingerprint());
|
||||
} else {
|
||||
wprintln!("{} has the following keys:", vc.fingerprint());
|
||||
weprintln!("{} has the following keys:", vc.fingerprint());
|
||||
}
|
||||
wprintln!();
|
||||
weprintln!();
|
||||
for ka in vc.keys().skip(if only_subkeys { 1 } else { 0 }) {
|
||||
wprintln!(" - {}", ka.fingerprint());
|
||||
weprintln!(" - {}", ka.fingerprint());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user