cli experience improvements

This commit is contained in:
Nick Sweeting 2020-06-25 17:47:55 -04:00
parent e2a5e0136c
commit 43c471e4af
6 changed files with 33 additions and 12 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 3.0.7 on 2020-06-25 15:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='snapshot',
name='timestamp',
field=models.CharField(default=None, max_length=32, null=True),
),
]

View file

@ -12,7 +12,7 @@ class Snapshot(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
url = models.URLField(unique=True)
timestamp = models.CharField(unique=True, max_length=32, null=True, default=None)
timestamp = models.CharField(max_length=32, null=True, default=None)
title = models.CharField(max_length=128, null=True, default=None)
tags = models.CharField(max_length=256, null=True, default=None)

View file

@ -33,6 +33,7 @@ def save_favicon(link: Link, out_dir: Optional[str]=None, timeout: int=TIMEOUT)
output: ArchiveOutput = 'favicon.ico'
cmd = [
CURL_BINARY,
'--silent',
'--max-time', str(timeout),
'--location',
'--output', str(output),

View file

@ -483,7 +483,7 @@ def add(import_str: Optional[str]=None,
check_data_folder(out_dir=out_dir)
if import_str and import_path:
if (import_str and import_path) or (not import_str and not import_path):
stderr(
'[X] You should pass either an import path as an argument, '
'or pass a list of links via stdin, but not both.\n',
@ -492,7 +492,7 @@ def add(import_str: Optional[str]=None,
raise SystemExit(2)
elif import_str:
import_path = save_stdin_to_sources(import_str, out_dir=out_dir)
else:
elif import_path:
import_path = save_file_to_sources(import_path, out_dir=out_dir)
check_dependencies()

View file

@ -7,6 +7,7 @@ if __name__ == '__main__':
# versions of ./manage.py commands whenever possible. When that's not possible
# (e.g. makemigrations), you can comment out this check temporarily
if not ('makemigrations' in sys.argv or 'migrate' in sys.argv):
print("[X] Don't run ./manage.py directly, use the archivebox CLI instead e.g.:")
print(' archivebox manage createsuperuser')
print()

View file

@ -25,6 +25,7 @@ from .config import OUTPUT_PERMISSIONS
def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Patched of subprocess.run to fix blocking io making timeout=innefective"""
if input is not None:
if 'stdin' in kwargs:
raise ValueError('stdin and input arguments may not both be used.')