harmont_cli/output/
mod.rs1pub mod human;
2pub mod json;
3pub mod progress;
4pub mod spinner;
5
6#[derive(Debug, Clone)]
8pub enum OutputMode {
9 Human {
10 color: bool,
12 interactive: bool,
14 },
15 Json,
16}
17
18impl OutputMode {
19 #[must_use]
21 pub const fn is_json(&self) -> bool {
22 matches!(self, Self::Json)
23 }
24
25 #[must_use]
27 pub const fn is_human(&self) -> bool {
28 matches!(self, Self::Human { .. })
29 }
30
31 #[must_use]
33 pub const fn color_enabled(&self) -> bool {
34 matches!(self, Self::Human { color: true, .. })
35 }
36
37 #[must_use]
39 pub const fn interactive(&self) -> bool {
40 matches!(
41 self,
42 Self::Human {
43 interactive: true,
44 ..
45 }
46 )
47 }
48
49 #[must_use]
51 pub const fn use_hyperlinks(&self) -> bool {
52 matches!(
53 self,
54 Self::Human {
55 interactive: true,
56 color: true
57 }
58 )
59 }
60}