Skip to main content

commit_wizard/engine/models/runtime/
options.rs

1#[derive(Debug, Clone)]
2pub struct RuntimeOptions {
3    dry_run: bool,
4    auto_yes: bool,
5    force: bool,
6    output_envelope: scriba::EnvelopeMode,
7    output_format: scriba::Format,
8    output_color: scriba::ColorMode,
9    log_level: scriba::Level,
10}
11
12impl Default for RuntimeOptions {
13    fn default() -> Self {
14        Self::new()
15    }
16}
17
18impl RuntimeOptions {
19    pub fn new() -> Self {
20        Self {
21            dry_run: false,
22            auto_yes: false,
23            force: false,
24            output_envelope: scriba::EnvelopeMode::None,
25            output_format: scriba::Format::Text,
26            output_color: scriba::ColorMode::Auto,
27            log_level: scriba::Level::Normal,
28        }
29    }
30
31    pub fn dry_run(&self) -> bool {
32        self.dry_run
33    }
34
35    pub fn set_dry_run(&mut self, dry_run: bool) -> &mut Self {
36        self.dry_run = dry_run;
37        self
38    }
39
40    pub fn auto_yes(&self) -> bool {
41        self.auto_yes
42    }
43
44    pub fn set_auto_yes(&mut self, auto_yes: bool) -> &mut Self {
45        self.auto_yes = auto_yes;
46        self
47    }
48
49    pub fn force(&self) -> bool {
50        self.force
51    }
52
53    pub fn set_force(&mut self, force: bool) -> &mut Self {
54        self.force = force;
55        self
56    }
57
58    pub fn output_envelope(&self) -> scriba::EnvelopeMode {
59        self.output_envelope
60    }
61
62    pub fn set_output_envelope(&mut self, output_envelope: scriba::EnvelopeMode) -> &mut Self {
63        self.output_envelope = output_envelope;
64        self
65    }
66
67    pub fn output_format(&self) -> scriba::Format {
68        self.output_format
69    }
70
71    pub fn set_output_format(&mut self, output_format: scriba::Format) -> &mut Self {
72        self.output_format = output_format;
73        self
74    }
75
76    pub fn output_color(&self) -> scriba::ColorMode {
77        self.output_color
78    }
79
80    pub fn set_output_color(&mut self, output_color: scriba::ColorMode) -> &mut Self {
81        self.output_color = output_color;
82        self
83    }
84
85    pub fn log_level(&self) -> scriba::Level {
86        self.log_level
87    }
88
89    pub fn set_log_level(&mut self, log_level: scriba::Level) -> &mut Self {
90        self.log_level = log_level;
91        self
92    }
93}