import re

from .importoparl import Command as ImportOParlCommand


class Command(ImportOParlCommand):
    help = 'Import the bodies from an oparl api into the database'

    def add_arguments(self, parser, add_entrypoint=True):
        super().add_arguments(parser, add_entrypoint)
        parser.add_argument('list', type=str)

    def handle(self, *args, **options):
        importer = self.import_importer(options)
        importer = importer(options)

        bodies = importer.get_bodies()
        for body in bodies:
            if options["list"] == "paper":
                importer.list_batched(body.get_paper, importer.paper)
            elif options["list"] == "person":
                importer.list_batched(body.get_person, importer.person)
            elif options["list"] == "organization":
                importer.list_batched(body.get_organization, importer.organization)
            elif options["list"] == "meeting":
                importer.list_batched(body.get_meeting, importer.meeting)
            else:
                raise ValueError("Invalid list " + options["list"])

@@ -316,16 +316,62 @@
 t', 
-type=str
+choices=%5B%22paper%22, %22person%22, %22organization%22, %22meeting%22%5D
 )%0A%0A 

Fix argument definition in importlist