mirror of
https://github.com/tealdeer-rs/tealdeer.git
synced 2026-08-09 09:49:10 +02:00
Add note about auto-updates when cache is missing (#254)
This commit is contained in:
parent
716ff15779
commit
5a1a21b8ab
2 changed files with 16 additions and 6 deletions
14
src/main.rs
14
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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue