From 31a6318582fb375a2d2b698a1312e38b7222fa49 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 18 Aug 2020 18:32:11 -0400 Subject: [PATCH] better colors, hints, and progress bars in docker --- README.md | 6 +++--- archivebox/config/__init__.py | 8 ++++---- archivebox/logging_util.py | 19 +++++++++++-------- docker-compose.yml | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c263932e..406cfa38 100644 --- a/README.md +++ b/README.md @@ -62,10 +62,10 @@ To get started, you can [install them manually](https://github.com/pirate/Archiv ```bash # Docker mkdir data && cd data -docker run -v $PWD:/data nikisweeting/archivebox init -docker run -v $PWD:/data nikisweeting/archivebox add 'https://example.com' +docker run -v $PWD:/data -it nikisweeting/archivebox init +docker run -v $PWD:/data -it nikisweeting/archivebox add 'https://example.com' docker run -v $PWD:/data -it nikisweeting/archivebox manage createsuperuser -docker run -v $PWD:/data -p 8000:8000 nikisweeting/archivebox server 0.0.0.0:8000 +docker run -v $PWD:/data -it -p 8000:8000 nikisweeting/archivebox server 0.0.0.0:8000 open http://127.0.0.1:8000 ``` diff --git a/archivebox/config/__init__.py b/archivebox/config/__init__.py index 59bb521f..f4edcf85 100644 --- a/archivebox/config/__init__.py +++ b/archivebox/config/__init__.py @@ -840,10 +840,10 @@ def check_dependencies(config: ConfigDict=CONFIG, show_help: bool=True) -> None: info['version'] or 'unable to detect version', ) ) - # if dependency in ("SINGLEFILE_BINARY", "READABILITY_BINARY"): - # hint(('npm install --prefix . "git+https://github.com/pirate/ArchiveBox.git"', - # f'or set SAVE_{dependency.rsplit("_", 1)[0]}=False to silence this warning', - # '')) + if dependency in ('SINGLEFILE_BINARY', 'READABILITY_BINARY'): + hint(('npm install --prefix . "git+https://github.com/piratee/ArchiveBox.git"', + f'or set SAVE_{dependency.rsplit("_", 1)[0]}=False to silence this warning', + ''), prefix=' ') stderr('') if config['TIMEOUT'] < 5: diff --git a/archivebox/logging_util.py b/archivebox/logging_util.py index 71a50c56..b79557a6 100644 --- a/archivebox/logging_util.py +++ b/archivebox/logging_util.py @@ -99,15 +99,18 @@ class TimedProgress: if self.SHOW_PROGRESS: # terminate if we havent already terminated - self.p.terminate() - self.p.join() - self.p.close() - - # clear whole terminal line try: - sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH()), ANSI['reset'])) - except (IOError, BrokenPipeError): - # ignore when the parent proc has stopped listening to our stdout + self.p.terminate() + self.p.join() + self.p.close() + + # clear whole terminal line + try: + sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH()), ANSI['reset'])) + except (IOError, BrokenPipeError): + # ignore when the parent proc has stopped listening to our stdout + pass + except ValueError: pass diff --git a/docker-compose.yml b/docker-compose.yml index c8733e1b..a209e959 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: # host machine, add tasks and see more info with archivebox schedule --help # scheduler: # image: nikisweeting/archivebox:latest - # command: schedule --foreground --every=day --depth=1 'https://getpocket.com/users/USERNA