浏览代码

better colors, hints, and progress bars in docker

Nick Sweeting 5 年之前
父节点
当前提交
31a6318582
共有 4 个文件被更改,包括 19 次插入16 次删除
  1. 3 3
      README.md
  2. 4 4
      archivebox/config/__init__.py
  3. 11 8
      archivebox/logging_util.py
  4. 1 1
      docker-compose.yml

+ 3 - 3
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
 ```
 

+ 4 - 4
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:

+ 11 - 8
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
 
 

+ 1 - 1
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<E/feed/all'
+    #    command: schedule --foreground --every=day --depth=1 'https://getpocket.com/users/USERNAME/feed/all'
     #    environment:
     #        - USE_COLOR=True
     #        - SHOW_PROGRESS=False