Skip to content

Commit

Permalink
Update error message for when CACHE_DIR contains non-cache files
Browse files Browse the repository at this point in the history
  • Loading branch information
superatomic committed Aug 27, 2023
1 parent 9286a6e commit 8342da2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/tldr_man/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,15 @@ def ensure_cache_dir_update_safety():
if not (path.is_dir() and EXPECTED_CACHE_CONTENT_PATTERN.match(path.name))]

if problematic_files:
exit_with('\n\n'.join([
f"Error: Cache directory at {format_filename(CACHE_DIR)} contains non-cache files. Updating could cause data loss.",
'\n'.join([
exit_with('\n'.join([
f"Error: Cache directory at {format_filename(CACHE_DIR)} contains non-cache files.",
"Updating could cause data loss and is a potentially destructive action.",
"",
"The following files would be removed:",
*problematic_files,
]),
(
"To force an update, run the following command to delete the cache "
"(this action is potentially destructive!):\n"
f" rm -r {shlex.quote(str(CACHE_DIR))}"
),
"",
"To force an update, run the following command to delete the cache:",
f" rm -r {shlex.quote(str(CACHE_DIR))}",
]))


Expand Down

0 comments on commit 8342da2

Please sign in to comment.