use std::path::PathBuf;
use std::time::Duration;
use crate::output::OutputFormat;
#[derive(Debug, Clone)]
pub struct WatchConfig {
pub debounce: Duration,
pub format: OutputFormat,
pub output: Option<PathBuf>,
pub html: bool,
pub open_browser: bool,
}
impl WatchConfig {
pub fn new() -> Self {
Self {
debounce: Duration::from_millis(200),
format: OutputFormat::Json,
output: None,
html: false,
open_browser: true,
}
}
}
impl Default for WatchConfig {
fn default() -> Self {
Self::new()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn watch_config_default_values() {
let cfg = WatchConfig::default();
assert_eq!(cfg.debounce, Duration::from_millis(200));
assert_eq!(cfg.format, OutputFormat::Json);
assert!(cfg.output.is_none());
assert!(!cfg.html);
assert!(cfg.open_browser);
}
}