diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/wikiget/dl.py | 6 | ||||
| -rw-r--r-- | src/wikiget/wikiget.py | 6 |
2 files changed, 9 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 diff --git a/src/wikiget/wikiget.py b/src/wikiget/wikiget.py index cf877cf..693decb 100644 --- a/src/wikiget/wikiget.py +++ b/src/wikiget/wikiget.py @@ -113,6 +113,12 @@ def construct_parser() -> argparse.ArgumentParser: help="number of parallel downloads to attempt in batch mode", type=int, ) + parser.add_argument( + "-n", + "--dry-run", + action="store_true", + help="check the download or batch file without actually downloading anything", + ) return parser |
