Add cli options to the program

This commit is contained in:
2025-08-03 22:15:03 +02:00
parent d310cce749
commit 36a3093522
3 changed files with 222 additions and 28 deletions
+27 -2
View File
@@ -1,3 +1,28 @@
fn main() {
println!("Hello, world!");
use structopt::StructOpt;
use wikipedia_infobox_analyzer::wikipedia_infobox_analyzer::*;
#[derive(StructOpt)]
struct Cli {
#[structopt(default_value = "Earth", long = "title")]
wikipedia_article_title: String,
#[structopt(default_value = "en", long = "lang")]
wikipedia_language_code: String,
#[structopt(long = "template", parse(from_os_str))]
infobox_template_file: std::path::PathBuf,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = Cli::from_args();
// Input to the program
let qid = fetch_wiki_item_by_article_title(
args.wikipedia_article_title,
args.wikipedia_language_code,
);
let _template_file = std::fs::read_to_string(&args.infobox_template_file)?;
println!("Qid: {qid}");
println!("Template file exists");
Ok(())
}