add --first and --debug flags

This commit is contained in:
Connor Olding 2020-09-08 12:54:13 +02:00
parent 1c1a5e7992
commit e1ff8918cc

View File

@ -22,10 +22,23 @@ def ui(program, args):
desc = "enable all checks instead of only the most likely ones"
parser.add_argument("--all", action="store_true", help=desc)
desc = "enable only the first check"
parser.add_argument("--first", action="store_true", help=desc)
desc = "enable debugging verbosity"
parser.add_argument("--debug", action="store_true", help=desc)
a = parser.parse_args(args)
checks = [] + chk.first
checks += chk.checks if a.all else chk.likely
if a.first and a.all:
parser.error("--all and --first cannot be used together")
elif a.all:
checks += chk.checks
elif a.first:
pass
else:
checks += chk.likely
opts = Options()
opts.dry = a.database is None
@ -40,8 +53,8 @@ def ui(program, args):
else:
uri = "sqlite:///" + a.database
def runwrap(db, debug=False):
if debug:
def runwrap(db):
if a.debug:
import logging
logging.basicConfig(level=logging.DEBUG)
run(main(db, a.path, checks, opts), debug=True)