Browse Source

Add --verbose to control output

master
Schneider 4 years ago
parent
commit
70d3b4aa02
Signed by: schneider GPG Key ID: 3F50B02A50039F3B
  1. 15
      dirbuild.py

15
dirbuild.py

@ -2,14 +2,15 @@
"""dirbuild """dirbuild
Usage: Usage:
dirbuild
dirbuild set <command>
dirbuild get
dirbuild build
dirbuild dump
dirbuild [-v]
dirbuild [-v] set <command>
dirbuild [-v] get
dirbuild [-v] build
dirbuild [-v] dump
Options: Options:
-h --help Show this screen. -h --help Show this screen.
-v --verbose Show verbose information.
--version Show version. --version Show version.
""" """
@ -36,7 +37,7 @@ def init_logger():
formatter = logging.Formatter("%(asctime)s %(name)-12s %(levelname)-8s %(message)s") formatter = logging.Formatter("%(asctime)s %(name)-12s %(levelname)-8s %(message)s")
handler.setFormatter(formatter) handler.setFormatter(formatter)
logger.addHandler(handler) logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
logger.setLevel(logging.ERROR)
def init_db() -> sqlite3.Connection: def init_db() -> sqlite3.Connection:
@ -87,6 +88,8 @@ def main():
""" Main function """ """ Main function """
init_logger() init_logger()
arguments = docopt(__doc__, version="dirbuild v0.1.0") arguments = docopt(__doc__, version="dirbuild v0.1.0")
if arguments["--verbose"]:
logger.setLevel(logging.DEBUG)
logger.debug("arguments: %s", arguments) logger.debug("arguments: %s", arguments)
db = init_db() db = init_db()
if arguments["set"]: if arguments["set"]:

Loading…
Cancel
Save