Add cli options to the program
This commit is contained in:
+27
-2
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user