add index-only option to archivebox add and update

This commit is contained in:
Nick Sweeting 2019-04-25 18:59:41 -04:00
parent 95a7d3d1de
commit d248684839
4 changed files with 19 additions and 3 deletions

View file

@ -8,7 +8,7 @@ from importlib import import_module
CLI_DIR = os.path.dirname(os.path.abspath(__file__))
# these common commands will appear sorted before any others for ease-of-use
display_first = ('help', 'version', 'init', 'info', 'list', 'update', 'add', 'remove')
display_first = ('help', 'version', 'init', 'info', 'config', 'list', 'update', 'add', 'remove')
# every imported command module must have these properties in order to be valid
required_attrs = ('__package__', '__command__', 'main')

View file

@ -7,6 +7,8 @@ __description__ = 'Add a new URL or list of URLs to your archive'
import sys
import argparse
from typing import List, Optional
from ..legacy.config import stderr, check_dependencies, check_data_folder
from ..legacy.util import (
handle_stdin_import,
@ -15,7 +17,7 @@ from ..legacy.util import (
from ..legacy.main import update_archive_data
def main(args=None, stdin=None):
def main(args: List[str]=None, stdin: Optional[str]=None) -> None:
check_data_folder()
args = sys.argv[1:] if args is None else args
@ -36,6 +38,11 @@ def main(args=None, stdin=None):
action='store_true',
help="Don't attempt to retry previously skipped/failed links when updating",
)
parser.add_argument(
'--index-only', #'-o',
action='store_true',
help="Add the links to the main index without archiving them",
)
# parser.add_argument(
# '--mirror', #'-m',
# action='store_true',
@ -81,6 +88,7 @@ def main(args=None, stdin=None):
import_path=import_path,
resume=None,
only_new=command.only_new,
index_only=command.index_only,
)

View file

@ -7,13 +7,14 @@ __description__ = 'Import any new links from subscriptions and retry any previou
import sys
import argparse
from typing import List
from ..legacy.config import check_data_folder
from ..legacy.util import reject_stdin
from ..legacy.main import update_archive_data
def main(args=None):
def main(args: List[str]=None):
check_data_folder()
args = sys.argv[1:] if args is None else args
@ -28,6 +29,11 @@ def main(args=None):
action='store_true',
help="Don't attempt to retry previously skipped/failed links when updating",
)
parser.add_argument(
'--index-only', #'-o',
action='store_true',
help="Update the main index without archiving any content",
)
parser.add_argument(
'--resume', #'-r',
type=float,
@ -41,6 +47,7 @@ def main(args=None):
import_path=None,
resume=command.resume,
only_new=command.only_new,
index_only=command.index_only,
)

View file

@ -15,6 +15,7 @@ ACTIVE_THEME = 'default'
IS_SHELL = 'shell' in sys.argv[:3] or 'shell_plus' in sys.argv[:3]
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',