commit
069ec2f7fa
|
@ -0,0 +1 @@
|
||||||
|
/target
|
File diff suppressed because it is too large
Load Diff
|
@ -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"] }
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue