Change sq config inspect paths to use stdout.

- Change `sq config inspect paths ` to use `stdout`, not `stderr`,
    for its main output.

  - See #342.
This commit is contained in:
Neal H. Walfield 2024-12-03 18:51:56 +01:00
parent 93217dcfd0
commit a47a130d42
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3

View File

@ -141,24 +141,26 @@ fn network(sq: Sq, _: inspect::network::Command) -> Result<()> {
/// Implements `sq config inspect paths`. /// Implements `sq config inspect paths`.
fn paths(sq: Sq, _: inspect::paths::Command) -> Result<()> { fn paths(sq: Sq, _: inspect::paths::Command) -> Result<()> {
let o = &mut std::io::stdout();
// Whether we have emitted anything. // Whether we have emitted anything.
let mut dirty = false; let mut dirty = false;
// Formats a path. // Formats a path.
let mut p = |path: &Path, name: &str, description: &str| -> Result<()> { let mut p = |path: &Path, name: &str, description: &str| -> Result<()> {
if dirty { if dirty {
weprintln!(); wwriteln!(o);
} }
dirty = true; dirty = true;
weprintln!(initial_indent = " - ", "{}", name); wwriteln!(stream=o, initial_indent = " - ", "{}", name);
weprintln!(initial_indent = " - ", "{}", path.display()); wwriteln!(stream=o, initial_indent = " - ", "{}", path.display());
if ! path.exists() { if ! path.exists() {
weprintln!(initial_indent = " - ", "does not exist"); wwriteln!(stream=o, initial_indent = " - ", "does not exist");
} }
weprintln!(initial_indent = " - ", "{}", description); wwriteln!(stream=o, initial_indent = " - ", "{}", description);
Ok(()) Ok(())
}; };