From e68059f873e97d88d6bc83a421535e235a0b1527 Mon Sep 17 00:00:00 2001
From: Egor Tensin <Egor.Tensin@gmail.com>
Date: Tue, 30 Mar 2021 09:49:55 +0300
Subject: add --verbose flag

---
 .ci/local/test.sh | 2 +-
 cgitize/main.py   | 8 +++++---
 cgitize/utils.py  | 5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/.ci/local/test.sh b/.ci/local/test.sh
index 99728e4..8ae7fe9 100755
--- a/.ci/local/test.sh
+++ b/.ci/local/test.sh
@@ -127,7 +127,7 @@ cgitize() {
     echo Running cgitize
     echo ----------------------------------------------------------------------
 
-    python3 -m cgitize.main --config "$cgitize_conf_path"
+    python3 -m cgitize.main --config "$cgitize_conf_path" --verbose
 }
 
 check_contains() {
diff --git a/cgitize/main.py b/cgitize/main.py
index dd6b41e..60a5e70 100644
--- a/cgitize/main.py
+++ b/cgitize/main.py
@@ -16,18 +16,20 @@ def parse_args(argv=None):
     if argv is None:
         argv = sys.argv[1:]
     parser = ArgumentParser()
-    parser.add_argument('--config', metavar='PATH',
+    parser.add_argument('--config', '-c', metavar='PATH',
                         default=Config.DEFAULT_PATH,
                         help='config file path')
     parser.add_argument('--repo', metavar='REPO_ID',
                         nargs='*', dest='repos',
                         help='repos to pull')
+    parser.add_argument('--verbose', '-v', action='store_true',
+                        help='verbose log output')
     return parser.parse_args(argv)
 
 
 def main(args=None):
-    with setup_logging():
-        args = parse_args(args)
+    args = parse_args()
+    with setup_logging(args.verbose):
         config = Config.read(args.config)
         my_repos = config.import_my_repos()
         cgit_server = CGitServer(config.clone_url)
diff --git a/cgitize/utils.py b/cgitize/utils.py
index 152684f..2f91939 100644
--- a/cgitize/utils.py
+++ b/cgitize/utils.py
@@ -12,9 +12,10 @@ import sys
 
 
 @contextmanager
-def setup_logging():
+def setup_logging(verbose=False):
+    level = logging.DEBUG if verbose else logging.INFO
     logging.basicConfig(
-        level=logging.DEBUG,
+        level=level,
         datefmt='%Y-%m-%d %H:%M:%S',
         format='%(asctime)s | %(levelname)s | %(message)s',
         # Log to stdout, because that's where subprocess's output goes (so that
-- 
cgit v1.2.3