diff --git a/src/main.rs b/src/main.rs index e58a322e..99b0eafa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -148,31 +148,22 @@ fn should_update_cache(args: &Args, config: &Config) -> bool { /// Check the cache for freshness fn check_cache(args: &Args, enable_styles: bool) { - match Cache::last_update() { - Some(ago) if ago > MAX_CACHE_AGE => { - if args.flag_quiet { - return; - } - - // Only use color if enabled - let warning_style = if enable_styles { - Style::new().fg(Color::Yellow) - } else { - Style::default() - }; - - println!( - "{}", - warning_style.paint(format!( - "The cache hasn't been updated for more than {} days.\n\ - You should probably run `tldr --update` soon.", - MAX_CACHE_AGE.as_secs() / 24 / 3600 - )) - ); + match Cache::last_update() { + Some(ago) if ago > MAX_CACHE_AGE => { + if args.flag_quiet { + return; } + + // Only use color if enabled + let warning_style = if enable_styles { + Style::new().fg(Color::Yellow) + } else { + Style::default() + }; + eprintln!( "{}", - Color::Yellow.paint(format!( + warning_style.paint(format!( "The cache hasn't been updated for more than {} days.\n\ You should probably run `tldr --update` soon.", MAX_CACHE_AGE.as_secs() / 24 / 3600 @@ -397,7 +388,7 @@ fn main() { if args.flag_list { if !cache_updated { // Check cache for freshness - check_cache(&args); + check_cache(&args, enable_styles); } // Get list of pages @@ -421,7 +412,7 @@ fn main() { if !cache_updated { // Check cache for freshness - check_cache(&args); + check_cache(&args, enable_styles); } // Search for command in cache