Initial commit

Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
master
TuDatTr 2023-06-10 21:53:14 +02:00
commit 069ec2f7fa
4 changed files with 2168 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

2129
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

12
Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "gsearch"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "4.3.3", features = ["derive"] }
futures-util = "0.3.28"
gscite = "1.0.0"
tokio = { version = "1.28.2", features = ["full"] }

26
src/main.rs Normal file
View File

@ -0,0 +1,26 @@
use gscite::{Client, ReferenceFormat};
use futures_util::StreamExt;
use futures_util::TryStreamExt;
use clap::Parser;
#[derive(Parser, Debug)]
#[command(author, version, about=None, long_about=None)]
pub struct Cli {
/// Search term
#[arg(short, long)]
pub search_term: String,
}
#[tokio::main]
async fn main() {
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();
for r in references {
println!("{}", r);
}
}