scsys_xtask/pipes/watch/
config.rs

1/*
2    Appellation: config <module>
3    Contrib: @FL03
4*/
5
6#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize), serde(default, rename_all = "snake_case"))]
7#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
8#[cfg_attr(feature = "clap", derive(clap::Parser))]
9pub struct WatcherConfig {
10    #[cfg_attr(feature = "clap", clap(long, short))]
11    pub(crate) target: Option<String>,
12    #[cfg_attr(feature = "clap", clap(long, short))]
13    pub(crate) output: Option<String>,
14    #[cfg_attr(feature = "clap", clap(long, short))]
15    pub(crate) input: Option<String>,    
16    #[cfg_attr(feature = "clap", arg(long, short, action = clap::ArgAction::SetTrue))]
17    pub(crate) verbose: bool,
18}
19
20impl WatcherConfig {
21    /// Creates a new `WatcherConfig` instance with default values.
22    pub fn new() -> Self {
23        Self::default()
24    }
25
26    /// Returns the target path.
27    pub fn target(&self) -> Option<&String> {
28        self.target.as_ref()
29    }
30
31    /// Returns the output path.
32    pub fn output(&self) -> Option<&String> {
33        self.output.as_ref()
34    }
35
36    /// Returns the input path.
37    pub fn input(&self) -> Option<&String> {
38        self.input.as_ref()
39    }
40}