quote input

This commit is contained in:
Adrian Malacoda 2018-05-06 03:27:53 -05:00
parent 60efb9f527
commit b9f3c8f445
2 changed files with 4 additions and 2 deletions

View File

@ -12,7 +12,7 @@ use stc::searchers::yugioh::{YugiohCard, YugiohSearcher};
use stc::searchers::mediawiki::{WikiPage, MediawikiSearcher}; use stc::searchers::mediawiki::{WikiPage, MediawikiSearcher};
fn main () { fn main () {
env_logger::init().unwrap(); env_logger::init();
let term = env::args().nth(1).expect("please supply a search term as argument"); let term = env::args().nth(1).expect("please supply a search term as argument");
let mut searchers = AggregateSearcher::new(); let mut searchers = AggregateSearcher::new();

View File

@ -15,6 +15,8 @@ use mopa::Any;
const NUM_RETRIES: usize = 10; const NUM_RETRIES: usize = 10;
const RETRY_WAIT_MILLIS: u64 = 500; const RETRY_WAIT_MILLIS: u64 = 500;
pub type MtgCard = Card;
impl Link for Card { impl Link for Card {
fn label (&self) -> &str { fn label (&self) -> &str {
&self.name &self.name
@ -55,7 +57,7 @@ impl MtgSearcher {
impl Searcher<Card> for MtgSearcher { impl Searcher<Card> for MtgSearcher {
fn exact_search (&self, name: &str) -> Option<Card> { fn exact_search (&self, name: &str) -> Option<Card> {
let search = format!(r#"!{}"#, name); let search = format!(r#"!"{}""#, name);
self.do_search(&search).unwrap_or(None) self.do_search(&search).unwrap_or(None)
} }
} }