1
use std::env;
2

            
3
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
4
pub enum AcceptMode {
5
    Disabled,
6
    Accept,
7
    AcceptWithTimes,
8
}
9

            
10
impl AcceptMode {
11
2292
    pub fn from_env() -> Self {
12
2292
        match env::var("ACCEPT").as_deref() {
13
            Ok("false") => Self::Disabled,
14
            Ok("true") => Self::Accept,
15
            Ok("with-times") => Self::AcceptWithTimes,
16
2292
            _ => Self::Disabled,
17
        }
18
2292
    }
19

            
20
2292
    pub fn accepts_outputs(self) -> bool {
21
2292
        !matches!(self, Self::Disabled)
22
2292
    }
23

            
24
1140
    pub fn records_expected_time(self) -> bool {
25
1140
        matches!(self, Self::AcceptWithTimes)
26
1140
    }
27

            
28
    pub fn refresh_hint() -> &'static str {
29
        "Run with ACCEPT=true or ACCEPT=with-times"
30
    }
31
}