Fix missing
This commit is contained in:
parent
c44c9fe789
commit
7eb4ae7848
14
src/pgd.rs
14
src/pgd.rs
|
@ -4,13 +4,13 @@ use std::process::exit;
|
||||||
use std::io::{stdout, stdin, Write};
|
use std::io::{stdout, stdin, Write};
|
||||||
use std::num::Wrapping;
|
use std::num::Wrapping;
|
||||||
use colored::*;
|
use colored::*;
|
||||||
use gclone::Cache;
|
use gclone::{Result, Cache};
|
||||||
|
|
||||||
fn flush_stdout() {
|
fn flush_stdout() {
|
||||||
stdout().flush().ok();
|
stdout().flush().ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() -> Result<()> {
|
||||||
let request = match env::args().nth(1) {
|
let request = match env::args().nth(1) {
|
||||||
Some(arg) => arg,
|
Some(arg) => arg,
|
||||||
None => {
|
None => {
|
||||||
|
@ -22,12 +22,12 @@ fn main() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
main_with_cache(&request, true);
|
main_with_cache(&request, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main_with_cache(request: &str, regen: bool) {
|
fn main_with_cache(request: &str, regen: bool) -> Result<()> {
|
||||||
|
|
||||||
let cache = Cache::read();
|
let cache = Cache::read()?;
|
||||||
|
|
||||||
let matches = cache.find(&request);
|
let matches = cache.find(&request);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ fn main_with_cache(request: &str, regen: bool) {
|
||||||
"warning:".bold().yellow(),
|
"warning:".bold().yellow(),
|
||||||
"directory not found, regenerating cache...".bold());
|
"directory not found, regenerating cache...".bold());
|
||||||
|
|
||||||
let cache = Cache::new();
|
let cache = Cache::new()?;
|
||||||
|
|
||||||
match cache.write() {
|
match cache.write() {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
|
@ -120,6 +120,8 @@ fn main_with_cache(request: &str, regen: bool) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue