from __future__ import absolute_import

import json

from django.core.management.base import BaseCommand, CommandError

from watchman.utils import get_checks


class Command(BaseCommand):
    help = 'Runs the default django-watchman checks'

    def handle(self, *args, **options):
        verbosity = options['verbosity']
        print_all_checks = verbosity == '2' or verbosity == '3'

        for check in get_checks():
            if callable(check):
                resp = json.dumps(check())
                if '"ok": false' in resp:
                    raise CommandError(resp)
                elif print_all_checks:
                    print resp

@@ -44,16 +44,49 @@
 ort json
+%0Afrom optparse import make_option
 %0A%0Afrom d
@@ -276,182 +276,935 @@
     
-def handle(self, *args, **options):%0A        verbosity = options%5B'verbosity'%5D%0A        print_all_checks = verbosity == '2' or verbosity == '3'%0A%0A        for check in get_checks(
+option_list = BaseCommand.option_list + (%0A        make_option(%0A            '-c',%0A            '--checks',%0A            dest='checks',%0A            help='A comma-separated list of watchman checks to run (full python dotted paths)'%0A        ),%0A        make_option(%0A            '-s',%0A            '--skips',%0A            dest='skips',%0A            help='A comma-separated list of watchman checks to skip (full python dotted paths)'%0A        ),%0A    )%0A%0A    def handle(self, *args, **options):%0A        check_list = None%0A        skip_list = None%0A        verbosity = options%5B'verbosity'%5D%0A        print_all_checks = verbosity == '2' or verbosity == '3'%0A%0A        checks = options%5B'checks'%5D%0A        skips = options%5B'skips'%5D%0A%0A        if checks is not None:%0A            check_list = checks.split(',')%0A%0A        if skips is not None:%0A            skip_list = skips.split(',')%0A%0A        for check in get_checks(check_list=check_list, skip_list=skip_list
 ):%0A 

Add check / skip ability to management command