cargo-reclaim 0.2.2

Safe Cargo cleanup for target directories, stale artifacts, and Cargo home caches
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::io::Write;

use super::CliError;

pub(super) fn write_error_json(output: &mut impl Write, error: &CliError) -> Result<(), CliError> {
    let document = serde_json::json!({
        "command": "cargo-reclaim",
        "error": {
            "kind": error.kind_label(),
            "message": error.to_string(),
        },
        "exit_code": error.exit_code_value(),
    });
    serde_json::to_writer(&mut *output, &document)?;
    writeln!(output)?;
    Ok(())
}