aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xwebmap-download8
1 files changed, 5 insertions, 3 deletions
diff --git a/webmap-download b/webmap-download
index c8c4178..997f5fe 100755
--- a/webmap-download
+++ b/webmap-download
@@ -140,6 +140,8 @@ if __name__ == '__main__':
help=f'destination directory for downloaded files (default: {os.curdir})')
parser.add_argument('--lockdir', default=None,
help='optional directory for lock files')
+ parser.add_argument('--quiet', action='store_true',
+ help='skip progress bars even when stderr is a TTY')
parser.add_argument('--debug', action='store_true', help=argparse.SUPPRESS)
parser.add_argument('--exit-code', default=True, action=argparse.BooleanOptionalAction,
help='whether to exit with status 1 in case of download failures')
@@ -163,11 +165,11 @@ if __name__ == '__main__':
sourcedef['layername'] = name
sources.append(sourcedef)
- if sys.stderr.isatty():
+ if args.quiet or not sys.stderr.isatty():
+ pbar = None
+ else:
from tqdm import tqdm
pbar = tqdm
- else:
- pbar = None
# intentionally leave the dirfd open until the program terminates
opendir_args = O_RDONLY|O_CLOEXEC|O_PATH|O_DIRECTORY