aboutsummaryrefslogtreecommitdiff
path: root/src/wikiget/dl.py
diff options
context:
space:
mode:
authorCody Logan <cody@lokken.dev>2023-10-24 13:31:54 -0700
committerCody Logan <cody@lokken.dev>2023-10-24 13:33:42 -0700
commitb51477decbb74b95b6b33420e26649f8a8d0e70f (patch)
treebff559915267225e658fb424d8350d7496316ce9 /src/wikiget/dl.py
parent2ea4fc946474ae0d0f3d0b21184f2e025bad7736 (diff)
downloadwikiget-b51477decbb74b95b6b33420e26649f8a8d0e70f.tar.gz
wikiget-b51477decbb74b95b6b33420e26649f8a8d0e70f.zip
Add dry run option, to test processing without actually downloading anything
Diffstat (limited to 'src/wikiget/dl.py')
-rw-r--r--src/wikiget/dl.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py
index 93e9743..5bc24e9 100644
--- a/src/wikiget/dl.py
+++ b/src/wikiget/dl.py
@@ -116,6 +116,8 @@ def download(f: File, args: Namespace) -> int:
if os.path.isfile(dest) and not args.force:
adapter.warning("File already exists, skipping download (use -f to force)")
errors += 1
+ elif args.dry_run:
+ adapter.warning("Dry run, so nothing actually downloaded")
else:
try:
fd = open(dest, "wb")
@@ -143,9 +145,7 @@ def download(f: File, args: Namespace) -> int:
try:
dl_sha1 = verify_hash(dest)
except OSError as e:
- adapter.error(
- f"File downloaded but could not be verified. {e}"
- )
+ adapter.error(f"File downloaded but could not be verified. {e}")
errors += 1
return errors