From e1ff8918cce24118d79aa2b37ccdea38d2dda615 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Tue, 8 Sep 2020 12:54:13 +0200 Subject: [PATCH] add --first and --debug flags --- respodns/ui.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/respodns/ui.py b/respodns/ui.py index 8b1cf73..4398321 100644 --- a/respodns/ui.py +++ b/respodns/ui.py @@ -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)