from django.core.management.base import BaseCommand

from api_v1.tasks import sync_external_printing_records


class Command(BaseCommand):
    help = '从外部 records 接口同步印染订单/任务'

    def add_arguments(self, parser):
        parser.add_argument('--limit', type=int, default=100)

    def handle(self, *args, **options):
        payload = sync_external_printing_records.run(limit=options['limit'])
        self.stdout.write(self.style.SUCCESS(str(payload)))
