diff --git a/Cargo.toml b/Cargo.toml index 6ddb219..87c0b6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gsearch" -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 8fdb26c..e520d60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use gscite::{Client, ReferenceFormat}; use futures_util::StreamExt; use futures_util::TryStreamExt; +use std::error::Error; use clap::Parser; @@ -13,14 +14,15 @@ pub struct Cli { } #[tokio::main] -async fn main() { +async fn main() -> Result<(), Box> { let args = Cli::parse(); let client = Client::default(); - let results = client.get_references(&args.search_term, ReferenceFormat::BibTeX).await.unwrap(); - let references = results.take(1).try_collect::>().await.unwrap(); + let results = client.get_references(&args.search_term, ReferenceFormat::BibTeX).await?; + let references = results.take(1).try_collect::>().await?; for r in references { - println!("{}", r); + println!("Url: https://scholar.google.com/scholar?q={}\n\nReference: \n{}", &args.search_term, r); } + Ok(()) }