From 97e3178ac7fc3ad3edcebd9056c0739bd3da89b9 Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Tue, 28 Jan 2020 14:38:46 -0800 Subject: Clean up progress bars once download is complete, unless -v is specified --- wikiget/dl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'wikiget/dl.py') diff --git a/wikiget/dl.py b/wikiget/dl.py index cd8e175..4dc65c5 100644 --- a/wikiget/dl.py +++ b/wikiget/dl.py @@ -114,8 +114,12 @@ def download(dl, args): print(e) sys.exit(1) else: - # download the file - with tqdm(total=file_size, unit='B', + # download the file(s) + if args.verbose >= 1: + leave_bars = True + else: + leave_bars = False + with tqdm(leave=leave_bars, total=file_size, unit='B', unit_scale=True, unit_divisor=1024) as progress_bar: with fd: res = site.connection.get(file_url, stream=True) -- cgit v1.2.3