Skip to main content

conc/library/
show.rs

1/// the different ways the command output can be displayed
2#[derive(Copy, Debug, Eq, PartialEq, Clone)]
3pub enum Show {
4    /// Display the names of the executed commands and their output.
5    All,
6
7    /// Display the names of the executed commands and only the output of failed commands.
8    Names,
9
10    /// Display only the names and output of failed commands.
11    Failed,
12}
13
14impl Show {
15    /// indicates whether to display the command name
16    #[must_use]
17    pub(crate) fn display_command(self) -> bool {
18        match self {
19            Show::All | Show::Names => true,
20            Show::Failed => false,
21        }
22    }
23
24    /// indicates whether to display the output of successful commands
25    #[must_use]
26    pub(crate) fn display_success(self) -> bool {
27        match self {
28            Show::All => true,
29            Show::Names | Show::Failed => false,
30        }
31    }
32}