mod konachan;
mod yandere;
pub use konachan::KonachanFetcher;
pub use yandere::YandereFetcher;
use crate::lazy_static;
use clap::{Args, Subcommand, ValueEnum};
lazy_static! {
pub(crate) static ref TO_DEFAULT: &'static str = ".";
pub(crate) static ref TIME_FMT: &'static str = "%Y%m%d";
}
#[derive(Clone, Subcommand)]
pub enum Commands {
Y(DownloadArgs),
K(DownloadArgs),
}
#[derive(Args, Clone)]
pub struct DownloadArgs {
#[arg(value_enum)]
pub by: DownloadType,
#[arg(short, long)]
pub location: Option<String>,
pub id: Option<String>,
#[arg(short, long)]
pub tag: Option<String>,
#[arg(short, long)]
pub pages: Option<u16>,
#[arg(short, long)]
pub start: Option<String>,
#[arg(short, long)]
pub end: Option<String>,
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum DownloadType {
Id,
Day,
Week,
Month,
Tag,
Random,
}
#[cfg(test)]
mod tests {
use chrono::{Datelike, NaiveDate};
#[test]
fn test() {
let nd = NaiveDate::parse_from_str("2015/9/30", "%Y/%m/%d").expect("fail to parse time");
nd.week(chrono::Weekday::Wed);
let m = NaiveDate::from_ymd_opt(2023, 2, 28)
.expect("fail to parse")
.month();
println!("{}, {m}", nd.to_string());
}
}