ArchiveBox/archivebox/cli/archivebox_shell.py
2019-04-22 19:06:48 -04:00

33 lines
741 B
Python

#!/usr/bin/env python3
__package__ = 'archivebox.cli'
__command__ = 'archivebox shell'
__description__ = 'Enter an interactive ArchiveBox Django shell'
import sys
import argparse
from ..legacy.config import setup_django, OUTPUT_DIR, check_data_folder
from ..legacy.util import reject_stdin
def main(args=None):
check_data_folder()
args = sys.argv[1:] if args is None else args
parser = argparse.ArgumentParser(
prog=__command__,
description=__description__,
add_help=True,
)
parser.parse_args(args)
reject_stdin(__command__)
setup_django(OUTPUT_DIR)
from django.core.management import call_command
call_command("shell_plus")
if __name__ == '__main__':
main()