Generate cache and save it on first run

This commit is contained in:
Thomas Forgione 2019-02-12 16:24:48 +01:00
parent 1b15bd678c
commit a56db54b72
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 5 additions and 1 deletions

View File

@ -18,7 +18,11 @@ fn main_with_cache(request: &str, regen: bool) -> Result<()> {
let (cache, just_generated) = match Cache::read() { let (cache, just_generated) = match Cache::read() {
Ok(c) => (c, false), Ok(c) => (c, false),
Err(_) => (Cache::generate(), true), Err(_) => {
let cache = Cache::generate();
cache.write()?;
(cache, true)
},
}; };
let only_match = match cache.find_interactive(&request) { let only_match = match cache.find_interactive(&request) {