2021-02-13 16:39:29 +01:00
|
|
|
from django.core.management.base import BaseCommand
|
2021-02-14 17:08:29 +01:00
|
|
|
from documents.sanity_checker import check_sanity
|
2021-02-13 16:39:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
|
|
|
|
|
|
help = """
|
|
|
|
|
This command checks your document archive for issues.
|
|
|
|
|
""".replace(" ", "")
|
|
|
|
|
|
2021-04-18 15:56:00 +02:00
|
|
|
def add_arguments(self, parser):
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"--no-progress-bar",
|
|
|
|
|
default=False,
|
|
|
|
|
action="store_true",
|
|
|
|
|
help="If set, the progress bar will not be shown"
|
|
|
|
|
)
|
|
|
|
|
|
2021-02-13 16:39:29 +01:00
|
|
|
def handle(self, *args, **options):
|
|
|
|
|
|
2021-04-18 15:56:00 +02:00
|
|
|
messages = check_sanity(progress=not options['no_progress_bar'])
|
2021-02-13 16:39:29 +01:00
|
|
|
|
2021-02-14 17:08:29 +01:00
|
|
|
messages.log_messages()
|