# -*- coding: utf-8 -*-
# @Time    : 2019-03-20 12:02
# @Author  : luomingming
# @Desc    :


from scrapy.commands import ScrapyCommand


class Command(ScrapyCommand):
    requires_project = True

    def syntax(self):
        return '[options]'

    def short_desc(self):
        return 'Runs all of the spiders'

    def run(self, args, opts):
        spider_list = self.crawler_process.spiders.list()
        for name in spider_list:
            if name in args:
                self.crawler_process.crawl(name, **opts.__dict__)
        self.crawler_process.start()

