|
|
@ -17,14 +17,24 @@ lazy_static! {
|
|
|
|
/// Print usage then exit with code `1`
|
|
|
|
/// Print usage then exit with code `1`
|
|
|
|
pub fn usage() -> !
|
|
|
|
pub fn usage() -> !
|
|
|
|
{
|
|
|
|
{
|
|
|
|
println!("lolistealer version {}\n", env!("CARGO_PKG_VERSION"));
|
|
|
|
println!("lolistealer version {}", env!("CARGO_PKG_VERSION"));
|
|
|
|
println!("Usage: {} [--rating <filter expr>] [--tags <tag rules>][<outputs...>]", &PROGRAM_NAME[..]);
|
|
|
|
println!(" written by {} with <3", env!("CARGO_PKG_AUTHORS"));
|
|
|
|
|
|
|
|
println!(" licensed with GNU GPL 3.0 or later\n");
|
|
|
|
|
|
|
|
println!("Usage: {} [-q] [--rating <rating>] [--tags <filter expr>] [<outputs...>]", &PROGRAM_NAME[..]);
|
|
|
|
println!("Usage: {} --help", &PROGRAM_NAME[..]);
|
|
|
|
println!("Usage: {} --help", &PROGRAM_NAME[..]);
|
|
|
|
|
|
|
|
|
|
|
|
println!("Filter expression:");
|
|
|
|
println!("Options:");
|
|
|
|
|
|
|
|
println!(" -q\t\t\tQuiet mode, do not output progress");
|
|
|
|
|
|
|
|
println!(" --rating <rating>\tEither `s`afe, `q`uestionable, or `e`xplicit");
|
|
|
|
|
|
|
|
println!(" --tags <filter expr>\tFilter downloaded images out by tags, see below for format.");
|
|
|
|
|
|
|
|
println!("Tags filter expreession:");
|
|
|
|
println!(" tag_name\tMust contain this tag");
|
|
|
|
println!(" tag_name\tMust contain this tag");
|
|
|
|
println!(" -tag_name\tMust not contains this tag");
|
|
|
|
println!(" -tag_name\tMust not contains this tag");
|
|
|
|
println!(" +tag_name\tMust contains at least one tag prepended with `+`");
|
|
|
|
println!(" +tag_name\tMust contains at least one tag prepended with `+`");
|
|
|
|
|
|
|
|
println!("Note:");
|
|
|
|
|
|
|
|
println!(" Tag filter expreession is a single argument, tags must be seperated with spaces. e.g. 'tag1 -tag2 +tag3 +tag4'");
|
|
|
|
|
|
|
|
#[cfg(feature="async")]
|
|
|
|
|
|
|
|
println!("\n (compiled with threading support)");
|
|
|
|
|
|
|
|
|
|
|
|
std::process::exit(1)
|
|
|
|
std::process::exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -64,6 +74,7 @@ where I: IntoIterator<Item=String>
|
|
|
|
let mut one = String::default();
|
|
|
|
let mut one = String::default();
|
|
|
|
let mut reading = true;
|
|
|
|
let mut reading = true;
|
|
|
|
let mut tags = Vec::new();
|
|
|
|
let mut tags = Vec::new();
|
|
|
|
|
|
|
|
let mut verbose = Default::default();
|
|
|
|
|
|
|
|
|
|
|
|
macro_rules! take_one {
|
|
|
|
macro_rules! take_one {
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
@ -84,6 +95,7 @@ where I: IntoIterator<Item=String>
|
|
|
|
match arg.to_lowercase().trim() {
|
|
|
|
match arg.to_lowercase().trim() {
|
|
|
|
"-" => reading = false,
|
|
|
|
"-" => reading = false,
|
|
|
|
"--help" => return Ok(Mode::Help),
|
|
|
|
"--help" => return Ok(Mode::Help),
|
|
|
|
|
|
|
|
"-q" => verbose = config::Verbosity::Silent,
|
|
|
|
"--rating" if take_one!() => rating = one.parse::<config::Rating>()?,
|
|
|
|
"--rating" if take_one!() => rating = one.parse::<config::Rating>()?,
|
|
|
|
"--tags" if take_one!() => tags = tags::parse(&one),
|
|
|
|
"--tags" if take_one!() => tags = tags::parse(&one),
|
|
|
|
_ => paths.push(try_dir(arg)?),
|
|
|
|
_ => paths.push(try_dir(arg)?),
|
|
|
@ -97,7 +109,7 @@ where I: IntoIterator<Item=String>
|
|
|
|
return Err(Error::NoOutput);
|
|
|
|
return Err(Error::NoOutput);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ok(Mode::Normal(config::Config{rating, output: paths, tags}))
|
|
|
|
Ok(Mode::Normal(config::Config{rating, output: paths, tags, verbose}))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
|