Skip to main content

clawless_cli/output/
verbosity.rs

1/// Level of output detail requested by the user
2///
3/// `Verbosity` controls whether events are rendered by the presenter. It is
4/// orthogonal to [`OutputMode`], which controls format and destination.
5///
6/// Three levels are available:
7///
8/// - **Quiet**: suppress informational messages; show only results and errors.
9/// - **Default**: show normal messages and results.
10/// - **Verbose**: show everything including additional detail.
11///
12/// # Examples
13///
14/// ```
15/// use clawless_cli::output::Verbosity;
16///
17/// let verbosity = Verbosity::default();
18/// assert_eq!(verbosity, Verbosity::Default);
19/// ```
20///
21/// [`OutputFlags`]: super::OutputFlags
22/// [`OutputMode`]: super::OutputMode
23#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
24pub enum Verbosity {
25    /// Suppress informational messages; show only results and errors
26    Quiet,
27    /// Show normal messages and results
28    #[default]
29    Default,
30    /// Show everything including additional detail
31    Verbose,
32}
33
34#[cfg(test)]
35mod tests {
36    // An assertion in a test panics by design. A `# Panics` section on every test
37    // would repeat that and give the reader no information.
38    #![allow(clippy::missing_panics_doc)]
39
40    use super::*;
41
42    #[test]
43    fn default_is_default_variant() {
44        let verbosity = Verbosity::default();
45
46        assert_eq!(verbosity, Verbosity::Default);
47    }
48
49    #[test]
50    fn trait_send() {
51        fn assert_send<T: Send>() {}
52        assert_send::<Verbosity>();
53    }
54
55    #[test]
56    fn trait_sync() {
57        fn assert_sync<T: Sync>() {}
58        assert_sync::<Verbosity>();
59    }
60
61    #[test]
62    fn trait_unpin() {
63        fn assert_unpin<T: Unpin>() {}
64        assert_unpin::<Verbosity>();
65    }
66}