|
|
|
@ -54,6 +54,8 @@ pub struct Config
|
|
|
|
|
pub recursive: Recursion,
|
|
|
|
|
pub max_tasks: Option<NonZeroUsize>,
|
|
|
|
|
|
|
|
|
|
pub silent: bool,
|
|
|
|
|
|
|
|
|
|
#[cfg(feature="inspect")]
|
|
|
|
|
pub serialise_output: Option<Option<PathBuf>>, // Some(None) means dump to `stdout`
|
|
|
|
|
}
|
|
|
|
@ -94,6 +96,7 @@ impl Default for Config
|
|
|
|
|
paths: Vec::new(),
|
|
|
|
|
recursive: Default::default(),
|
|
|
|
|
max_tasks: None, //max_tasks_cpus(),
|
|
|
|
|
silent: false,
|
|
|
|
|
#[cfg(feature="inspect")]
|
|
|
|
|
serialise_output: None,
|
|
|
|
|
}
|
|
|
|
@ -145,3 +148,30 @@ impl fmt::Display for InvalidConfigError
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Print an error line in accordance with `Config`'s output directives.
|
|
|
|
|
#[macro_export] macro_rules! cfg_eprintln {
|
|
|
|
|
($cfg:expr, $fmt:literal $($tt:tt)*) => {
|
|
|
|
|
{
|
|
|
|
|
if !$cfg.silent {
|
|
|
|
|
eprintln!($fmt $($tt)*);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Print a line in accordance with `Config`'s output directives.
|
|
|
|
|
#[macro_export] macro_rules! cfg_println {
|
|
|
|
|
($cfg:expr, $fmt:literal $($tt:tt)*) => {
|
|
|
|
|
{
|
|
|
|
|
let cfg = &$cfg;
|
|
|
|
|
if !cfg.silent {
|
|
|
|
|
if cfg.is_using_stdout() {
|
|
|
|
|
eprintln!($fmt $($tt)*);
|
|
|
|
|
} else {
|
|
|
|
|
println!($fmt $($tt)*);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|