use argh::FromArgs;
#[derive(FromArgs)]
pub struct CommandLineArgs {
#[argh(switch, short = 'V')]
pub verbose: bool,
#[argh(switch, short = 'n')]
pub no_daemon: bool,
#[argh(switch, short = 'g')]
pub kill_pgroup: bool,
#[argh(option, short = 'p', long = "psi", default = "25.0")]
pub cutoff_psi: f32,
#[cfg(feature = "glob-ignore")]
#[argh(
option,
short = 'u',
long = "unkillables",
from_str_fn(parse_unkillables)
)]
pub ignored: Option<Vec<glob::Pattern>>,
}
#[cfg(feature = "glob-ignore")]
fn parse_unkillables(arg: &str) -> Result<Vec<glob::Pattern>, String> {
let unkillables: Result<Vec<_>, _> = arg.split('|').map(glob::Pattern::new).collect();
unkillables.map_err(|err| err.to_string())
}