foundry_common/
reports.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use serde::{Deserialize, Serialize};

use crate::shell;

#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum ReportKind {
    #[default]
    Text,
    JSON,
}

/// Determine the kind of report to generate based on the current shell.
pub fn report_kind() -> ReportKind {
    if shell::is_json() {
        ReportKind::JSON
    } else {
        ReportKind::Text
    }
}