Add date argument, verbose flag
This commit is contained in:
parent
b8a1c5461b
commit
cd08775783
1 changed files with 17 additions and 3 deletions
20
src/main.rs
20
src/main.rs
|
@ -1,5 +1,6 @@
|
|||
use anyhow::{bail, format_err, Result};
|
||||
use chrono::{DateTime, Local, LocalResult, NaiveDate, TimeZone, Utc};
|
||||
use clap::{arg, command, Parser};
|
||||
use html2md::parse_html;
|
||||
use log::{debug, trace};
|
||||
use megalodon::{
|
||||
|
@ -23,13 +24,26 @@ struct Page<'a> {
|
|||
newest: Option<&'a DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command()]
|
||||
struct Config {
|
||||
#[arg(required = true)]
|
||||
date: String,
|
||||
#[arg(short)]
|
||||
verbose: bool,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
env::set_var("RUST_LOG", format!("{}=debug", module_path!()));
|
||||
env_logger::init();
|
||||
let Config { date, verbose } = Config::parse();
|
||||
if verbose {
|
||||
env::set_var("RUST_LOG", format!("{}=debug", module_path!()));
|
||||
} else {
|
||||
env::set_var("RUST_LOG", format!("{}=none", module_path!()));
|
||||
}
|
||||
|
||||
// TODO add clap and argument for date
|
||||
let day = try_create_range("2023-07-01")?;
|
||||
let day = try_create_range(date)?;
|
||||
|
||||
debug!("Date {}", day.end.format("%Y-%m-%d"));
|
||||
|
||||
|
|
Loading…
Reference in a new issue