From: Oleg Broytman Date: Fri, 23 Mar 2018 22:31:26 +0000 (+0300) Subject: Fix(scripts/ml-import.py): Inhibit progress bar if stdout is not terminal X-Git-Tag: 0.0.17~2 X-Git-Url: https://git.phdru.name/?p=m_librarian.git;a=commitdiff_plain;h=bcbd3966732871818b9709669e5a5cc894247531 Fix(scripts/ml-import.py): Inhibit progress bar if stdout is not terminal --- diff --git a/docs/news.rst b/docs/news.rst index 3e73f9a..03347a1 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,11 @@ News ==== +Version 0.0.17 (2018-03-??) +--------------------------- + +* Inhibit progress bar if stdout is not terminal. + Version 0.0.16 (2018-03-22) --------------------------- diff --git a/scripts/ml-import.py b/scripts/ml-import.py index 47c6b1b..169a715 100755 --- a/scripts/ml-import.py +++ b/scripts/ml-import.py @@ -27,8 +27,9 @@ if __name__ == '__main__': open_db(args.database) init_db() import_glst() + use_pbar = ttyProgressBar and not args.no_pbar and sys.stdout.isatty() for inpx in args.inpx: - if ttyProgressBar and not args.no_pbar: + if use_pbar: if len(inpx) > 25: pbar_fname = inpx[:22] + '...' else: