mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-27 05:04:13 -04:00
feat: Patch setup_django so we can use an inmemory db in specific commands
This commit is contained in:
parent
35a5700c73
commit
9aac09a5e1
6 changed files with 18 additions and 13 deletions
|
@ -19,6 +19,8 @@ meta_cmds = ('help', 'version')
|
|||
main_cmds = ('init', 'info', 'config')
|
||||
archive_cmds = ('add', 'remove', 'update', 'list', 'status')
|
||||
|
||||
fake_db = ("oneshot",) + meta_cmds
|
||||
|
||||
display_first = (*meta_cmds, *main_cmds, *archive_cmds)
|
||||
|
||||
# every imported command module must have these properties in order to be valid
|
||||
|
@ -59,7 +61,7 @@ def run_subcommand(subcommand: str,
|
|||
pwd: Union[Path, str, None]=None) -> None:
|
||||
"""Run a given ArchiveBox subcommand with the given list of args"""
|
||||
from ..config import setup_django
|
||||
setup_django()
|
||||
setup_django(in_memory_db=subcommand in fake_db)
|
||||
|
||||
module = import_module('.archivebox_{}'.format(subcommand), __package__)
|
||||
module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue