diff --git a/src/main.rs b/src/main.rs index b2f3d3c..9ad2f41 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,15 +62,6 @@ fn main() -> Result<()> { return Ok(()); } - if should_use_cache { - println!( - "Saving current IP {} to cache file {:?}...", - ¤t_ip, - &args.cache.clone().unwrap() - ); - write_file(&args.cache.unwrap(), ¤t_ip)?; - } - let (api_token, zone, domain) = match args.config { Some(c) => { let config_str = read_file(&c)?; @@ -91,6 +82,15 @@ fn main() -> Result<()> { &domain, ¤t_ip ); + if should_use_cache { + println!( + "Saving current IP {} to cache file {:?}...", + ¤t_ip, + &args.cache.clone().unwrap() + ); + write_file(&args.cache.unwrap(), ¤t_ip)?; + } + Ok(()) }