|
|
@ -4,10 +4,13 @@ use std::collections::{HashMap, HashSet};
|
|
|
|
use std::mem::Discriminant;
|
|
|
|
use std::mem::Discriminant;
|
|
|
|
use std::fmt;
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use config::OutputSerialisationMode;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
|
|
pub enum Argument
|
|
|
|
pub enum Argument
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ModeChangeHelp,
|
|
|
|
ModeChangeHelp,
|
|
|
|
|
|
|
|
|
|
|
|
LimitConcMaxProc,
|
|
|
|
LimitConcMaxProc,
|
|
|
|
LimitConc(NonZeroUsize),
|
|
|
|
LimitConc(NonZeroUsize),
|
|
|
|
UnlimitConc,
|
|
|
|
UnlimitConc,
|
|
|
@ -29,6 +32,44 @@ pub enum Argument
|
|
|
|
Input(String),
|
|
|
|
Input(String),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Argument
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Insert this `Argument` into config
|
|
|
|
|
|
|
|
pub fn insert_into_cfg(self, cfg: &mut Config)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
use Argument::*;
|
|
|
|
|
|
|
|
match self {
|
|
|
|
|
|
|
|
LimitConcMaxProc => cfg.max_tasks = config::max_tasks_cpus(),
|
|
|
|
|
|
|
|
LimitConc(max) => cfg.max_tasks = Some(max),
|
|
|
|
|
|
|
|
UnlimitConc => cfg.max_tasks = None,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature="inspect")] Save(output) => cfg.serialise_output = Some(OutputSerialisationMode::File(output.into())),
|
|
|
|
|
|
|
|
#[cfg(feature="inspect")] SaveStdout => cfg.serialise_output = Some(OutputSerialisationMode::Stdout),
|
|
|
|
|
|
|
|
#[cfg(feature="inspect")] SaveRaw(output) => {
|
|
|
|
|
|
|
|
cfg_if! {
|
|
|
|
|
|
|
|
if #[cfg(feature="prealloc")] {
|
|
|
|
|
|
|
|
cfg.serialise_output = Some(OutputSerialisationMode::PreallocFile(output.into()));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cfg.serialise_output = Some(OutputSerialisationMode::RawFile(output.into()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
#[cfg(feature="inspect")] SaveRawStdout => cfg.serialise_output = Some(OutputSerialisationMode::RawStdout),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LimitRecurse(limit) => cfg.recursive = config::Recursion::Limited(limit),
|
|
|
|
|
|
|
|
UnlimitRecurse => cfg.recursive = config::Recursion::Unlimited,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogVerbose => cfg.output_level = config::OutputLevel::Verbose,
|
|
|
|
|
|
|
|
LogQuiet => cfg.output_level = config::OutputLevel::Quiet,
|
|
|
|
|
|
|
|
LogSilent => cfg.output_level = config::OutputLevel::Silent,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Input(path) => cfg.paths.push(path.into()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_ => unreachable!(),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl fmt::Display for Argument
|
|
|
|
impl fmt::Display for Argument
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
|
|