Clean up command line arguments.
This commit is contained in:
34
src/main.rs
34
src/main.rs
@@ -1,37 +1,23 @@
|
||||
use clap::Parser;
|
||||
mod blog;
|
||||
mod cli;
|
||||
mod error;
|
||||
mod og;
|
||||
|
||||
use clap::Parser;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::blog::Meta;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(author, version, about)]
|
||||
struct Args {
|
||||
/// Path to blog root.
|
||||
#[arg(
|
||||
short = 'i',
|
||||
long,
|
||||
value_hint = clap::ValueHint::DirPath,
|
||||
default_value = format!("../test_tree/")
|
||||
)]
|
||||
blog_path: PathBuf,
|
||||
|
||||
#[arg(short, long, value_hint = clap::ValueHint::DirPath)]
|
||||
fallback_meta: PathBuf,
|
||||
|
||||
#[arg(short, long, value_hint = clap::ValueHint::DirPath)]
|
||||
single_meta: PathBuf,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let config = Args::parse();
|
||||
let config = cli::Args::parse();
|
||||
|
||||
blog::FALLBACK_META_PATH.get_or_init(|| config.fallback_meta);
|
||||
|
||||
let _meta = Meta::try_from(config.single_meta).expect("Failed to deserialize single_meta file");
|
||||
let _meta = Meta::try_from(
|
||||
config
|
||||
.single_or_batch
|
||||
.single_meta
|
||||
.expect("No patch for single file processing."),
|
||||
)
|
||||
.expect("Failed to deserialize single_meta file");
|
||||
|
||||
println!("Loaded FallbackMeta");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user