Change sq pki link list to use stdout.
- Change `sq pki link list` to use `stdout`, not `stderr`, for its main output. - See #342.
This commit is contained in:
parent
3ac37dc386
commit
acbc039031
@ -171,6 +171,8 @@ pub fn list(sq: Sq, c: link::ListCommand)
|
|||||||
return Err(anyhow::anyhow!("Failed to resolve certificates"));
|
return Err(anyhow::anyhow!("Failed to resolve certificates"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let o = &mut std::io::stdout();
|
||||||
|
|
||||||
for cert in certs {
|
for cert in certs {
|
||||||
let cert = if let Ok(cert) = cert.to_cert() {
|
let cert = if let Ok(cert) = cert.to_cert() {
|
||||||
cert
|
cert
|
||||||
@ -203,19 +205,22 @@ pub fn list(sq: Sq, c: link::ListCommand)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if dirty {
|
if dirty {
|
||||||
weprintln!();
|
wwriteln!(stream=o);
|
||||||
}
|
}
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
weprintln!(initial_indent=" - ┌ ", subsequent_indent=" │ ",
|
wwriteln!(stream=o,
|
||||||
"{}", cert.fingerprint());
|
initial_indent=" - ┌ ", subsequent_indent=" │ ",
|
||||||
weprintln!(initial_indent=" └ ",
|
"{}", cert.fingerprint());
|
||||||
"{:?}", String::from_utf8_lossy(userid.value()));
|
wwriteln!(stream=o,
|
||||||
|
initial_indent=" └ ",
|
||||||
|
"{:?}", String::from_utf8_lossy(userid.value()));
|
||||||
|
|
||||||
const INDENT: &'static str = " - ";
|
const INDENT: &'static str = " - ";
|
||||||
|
|
||||||
if amount == 0 {
|
if amount == 0 {
|
||||||
weprintln!(initial_indent=INDENT, "link was retracted");
|
wwriteln!(stream=o, initial_indent=INDENT,
|
||||||
|
"link was retracted");
|
||||||
} else {
|
} else {
|
||||||
let mut regex: Vec<_> = certification.regular_expressions()
|
let mut regex: Vec<_> = certification.regular_expressions()
|
||||||
.map(|re| String::from_utf8_lossy(re))
|
.map(|re| String::from_utf8_lossy(re))
|
||||||
@ -234,28 +239,28 @@ pub fn list(sq: Sq, c: link::ListCommand)
|
|||||||
} else {
|
} else {
|
||||||
"is linked"
|
"is linked"
|
||||||
};
|
};
|
||||||
weprintln!(initial_indent=INDENT, "{}", summary);
|
wwriteln!(stream=o, initial_indent=INDENT, "{}", summary);
|
||||||
|
|
||||||
if let Some(e) = certification.signature_expiration_time() {
|
if let Some(e) = certification.signature_expiration_time() {
|
||||||
weprintln!(initial_indent=INDENT,
|
wwriteln!(stream=o, initial_indent=INDENT,
|
||||||
"expiration: {}",
|
"expiration: {}",
|
||||||
chrono::DateTime::<chrono::Utc>::from(e)
|
chrono::DateTime::<chrono::Utc>::from(e)
|
||||||
.format("%Y‑%m‑%d"));
|
.format("%Y‑%m‑%d"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if depth != 0 && depth != 255 {
|
if depth != 0 && depth != 255 {
|
||||||
weprintln!(initial_indent=INDENT,
|
wwriteln!(stream=o, initial_indent=INDENT,
|
||||||
"trust depth: {}", depth);
|
"trust depth: {}", depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if amount != sequoia_wot::FULLY_TRUSTED as u8 {
|
if amount != sequoia_wot::FULLY_TRUSTED as u8 {
|
||||||
weprintln!(initial_indent=INDENT,
|
wwriteln!(stream=o, initial_indent=INDENT,
|
||||||
"trust amount: {}", amount);
|
"trust amount: {}", amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! regex.is_empty() {
|
if ! regex.is_empty() {
|
||||||
weprintln!(initial_indent=INDENT,
|
wwriteln!(stream=o, initial_indent=INDENT,
|
||||||
"regular expressions: {}", regex.join("; "));
|
"regular expressions: {}", regex.join("; "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user