Skip to content

Commit 2e6e74e

Browse files
committed
cli: add logging and --trace option
1 parent fe4605c commit 2e6e74e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

compdb/cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import argparse
44
import io
5+
import logging
56
import os
67
import sys
78
import textwrap
@@ -475,6 +476,12 @@ def main(argv=None):
475476
description='{}.'.format(__desc__),
476477
formatter_class=SubcommandHelpFormatter)
477478

479+
parser.add_argument(
480+
'--trace',
481+
help="Trace execution",
482+
action="store_const",
483+
dest="loglevel",
484+
const=logging.INFO)
478485
parser.add_argument(
479486
'-c',
480487
dest='config_overrides',
@@ -539,6 +546,7 @@ def main(argv=None):
539546
# useful to show to the user instead of an error because of missing
540547
# subcommand
541548
args = parser.parse_args(argv or sys.argv[1:] or ["help"])
549+
logging.basicConfig(level=args.loglevel or logging.WARNING)
542550
config = compdb.config.LazyTypedConfig(config_schema)
543551

544552
if args.config_overrides:

contrib/zsh/functions/_compdb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ _compdb() {
132132
# TODO: smart completion of -c argument: section.option=value
133133
'*-c[set value of configuration variable NAME for this invocation]:key:'
134134
'*-p[build path]:build directory:_files -/'
135+
'--trace[trace execution]'
135136
)
136137

137138
local curcontext="$curcontext" state line

0 commit comments

Comments
 (0)