Added some rofi stuff for easier & quicker interaction
Looking actually pretty okay!
This commit is contained in:
@@ -13,10 +13,22 @@ struct Args {
|
||||
/// Download the latest bulk from Scryfall and update local db
|
||||
#[arg(short, long)]
|
||||
update: bool,
|
||||
/// Search for the exact string
|
||||
#[arg(short, long)]
|
||||
exact: bool,
|
||||
/// Text to search for card with
|
||||
search_text: Vec<String>,
|
||||
}
|
||||
|
||||
fn exact_search(search_strings: Vec<String>) {
|
||||
let search_string = search_strings.join(" ");
|
||||
let card = get_card_by_name(&search_string, GetNameType::Name);
|
||||
if card.is_none() {
|
||||
panic!("No card found with exact name of {}", search_string);
|
||||
}
|
||||
println!("{}", card.unwrap());
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
if args.update {
|
||||
@@ -30,6 +42,12 @@ fn main() {
|
||||
if args.search_text.is_empty() {
|
||||
panic!("You need to put some card text to search");
|
||||
}
|
||||
|
||||
if args.exact {
|
||||
exact_search(args.search_text);
|
||||
return;
|
||||
}
|
||||
|
||||
let mut search_string = String::new();
|
||||
for card in args.search_text {
|
||||
search_string.push_str(&card.to_lowercase());
|
||||
@@ -37,6 +55,7 @@ fn main() {
|
||||
}
|
||||
search_string.pop();
|
||||
|
||||
// This section should be replaced with a SQL command
|
||||
let cards = get_all_lowercase_card_names();
|
||||
|
||||
let mut matching_cards = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user