diff --git a/src/main.rs b/src/main.rs index 17e73586..216c3496 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,10 +81,20 @@ fn check_cache(args: &Args, enable_styles: bool) -> CheckCacheResult { CheckCacheResult::CacheFound } CacheFreshness::Missing => { - print_warning( + print_error( enable_styles, - "Cache not found. Please run `tldr --update`.", + &anyhow::anyhow!( + "Page cache not found. Please run `tldr --update` to download the cache." + ), ); + println!("\nNote: You can optionally enable automatic cache updates by adding the"); + println!("following config to your config file:\n"); + println!(" [updates]"); + println!(" auto_update = true\n"); + println!("The path to your config file can be looked up with `tldr --show-paths`."); + println!("To create an initial config file, use `tldr --seed-config`.\n"); + println!("You can find more tips and tricks in our docs:\n"); + println!(" https://dbrgn.github.io/tealdeer/config_updates.html"); CheckCacheResult::CacheMissing } } diff --git a/tests/lib.rs b/tests/lib.rs index 0f3128e4..7c544779 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -131,7 +131,7 @@ fn test_missing_cache() { .args(["sl"]) .assert() .failure() - .stderr(contains("Cache not found. Please run `tldr --update`.")); + .stderr(contains("Page cache not found. Please run `tldr --update`")); } #[test] @@ -143,7 +143,7 @@ fn test_update_cache() { .args(["sl"]) .assert() .failure() - .stderr(contains("Cache not found. Please run `tldr --update`.")); + .stderr(contains("Page cache not found. Please run `tldr --update`")); testenv .command() @@ -518,7 +518,7 @@ fn test_list_flag_rendering() { .args(["--list"]) .assert() .failure() - .stderr(contains("Cache not found. Please run `tldr --update`.")); + .stderr(contains("Page cache not found. Please run `tldr --update`")); testenv.add_entry("foo", ""); @@ -551,7 +551,7 @@ fn test_autoupdate_cache() { .args(["--list"]) .assert() .failure() - .stderr(contains("Cache not found. Please run `tldr --update`.")); + .stderr(contains("Page cache not found. Please run `tldr --update`")); let config_file_path = testenv.config_dir.path().join("config.toml"); let cache_file_path = testenv.cache_dir.path().join(TLDR_PAGES_DIR);