Add verbose flag

This commit is contained in:
Ales (Shagi) Zabala Alava 2020-11-08 20:04:07 +01:00
parent 261c8b6275
commit e36e5a1428
1 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import argparse import argparse
import configparser import configparser
import logging
import traceback import traceback
import sys import sys
from pathlib import Path from pathlib import Path
@ -91,6 +92,9 @@ def main():
# Build parser # Build parser
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument(
'-v', '--verbose', action='store_true',
help="Display informational messages.")
parser.set_defaults(command=None) parser.set_defaults(command=None)
subparsers = parser.add_subparsers() subparsers = parser.add_subparsers()
for command in commands: for command in commands:
@ -100,6 +104,8 @@ def main():
# Run command # Run command
args = parser.parse_args(args[1:]) args = parser.parse_args(args[1:])
if args.verbose:
logging.basicConfig(level=logging.DEBUG)
if args.command is None: if args.command is None:
parser.print_usage() parser.print_usage()
else: else: