Updated update and added an update script

The --update flag accepts the file no rather than goes to download.

Simpler. Better.

Don't need the entire download.rs file now
This commit is contained in:
2025-08-21 00:18:26 +01:00
parent 9f9a0b1fb7
commit af1ac9b5fa
3 changed files with 14 additions and 6 deletions

View File

@@ -31,9 +31,9 @@ enum MtgCardExit {
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// Download the latest bulk from Scryfall and update local db
/// Update the local db from given Scryfall bulk download
#[arg(short, long)]
update: bool,
update: Option<String>,
/// Search for the exact string
#[arg(short, long)]
exact: bool,
@@ -69,11 +69,11 @@ fn _combine_search_strings(search_strings: Vec<String>) -> String {
fn main() -> MtgCardExit {
let args = Args::parse();
if args.update {
if let Some(update) = args.update {
dbg!(&update);
init_db();
let mut path = get_local_cache_folder();
// TODO - actually download the file - probably do away with TempFile stuff
path.push("oracle-cards-20250814210711.json");
path.push(update);
update_db_with_file(path);
return MtgCardExit::Success;
}