Added search query in output
Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
This commit is contained in:
parent
b19d1afe6d
commit
a54a02a5fb
@ -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
|
||||
|
10
src/main.rs
10
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<dyn Error>> {
|
||||
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::<Vec<_>>().await.unwrap();
|
||||
let results = client.get_references(&args.search_term, ReferenceFormat::BibTeX).await?;
|
||||
let references = results.take(1).try_collect::<Vec<_>>().await?;
|
||||
|
||||
for r in references {
|
||||
println!("{}", r);
|
||||
println!("Url: https://scholar.google.com/scholar?q={}\n\nReference: \n{}", &args.search_term, r);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user