mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
allow running archivebox core commands from manage.py
This commit is contained in:
parent
168e578ea4
commit
29ced7b5c8
1 changed files with 10 additions and 3 deletions
|
@ -1,11 +1,18 @@
|
||||||
|
__package__ = 'archivebox'
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
from legacy.archive import main
|
from .cli import run_subcommand
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = 'ArchiveBox test.bee'
|
help = 'Run an ArchiveBox CLI subcommand (e.g. add, remove, list, etc)'
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument('subcommand', type=str, help='The subcommand you want to run')
|
||||||
|
parser.add_argument('command_args', nargs='*', help='Arguments to pass to the subcommand')
|
||||||
|
|
||||||
|
|
||||||
def handle(self, *args, **kwargs):
|
def handle(self, *args, **kwargs):
|
||||||
main(*args)
|
run_subcommand(kwargs['subcommand'], args=kwargs['command_args'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue