Skip to content

Commit 7010dff

Browse files
authored
Merge pull request #9622 from github/redsun82/swift-quiet-codegen
Swift: add --quiet to codegen
2 parents 687b9af + c9f48da commit 7010dff

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ repos:
4040
name: Run Swift checked in code generation
4141
files: ^swift/(codegen/|.*/generated/|ql/lib/(swift\.dbscheme$|codeql/swift/elements))
4242
language: system
43-
entry: bazel run //swift/codegen
43+
entry: bazel run //swift/codegen -- --quiet
4444
pass_filenames: false
4545

4646
- id: swift-codegen-unit-tests

swift/codegen/codegen.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _parse_args() -> argparse.Namespace:
1919
help="specify what targets to generate as a comma separated list, choosing among dbscheme, ql, trap "
2020
"and cpp")
2121
p.add_argument("--verbose", "-v", action="store_true", help="print more information")
22+
p.add_argument("--quiet", "-q", action="store_true", help="only print errors")
2223
p.add_argument("--swift-dir", type=_abspath, default=paths.swift_dir,
2324
help="the directory that should be regarded as the root of the swift codebase. Used to compute QL "
2425
"imports and in some comments (default %(default)s)")
@@ -48,7 +49,12 @@ def _abspath(x: str) -> pathlib.Path:
4849

4950
def run():
5051
opts = _parse_args()
51-
log_level = logging.DEBUG if opts.verbose else logging.INFO
52+
if opts.verbose:
53+
log_level = logging.DEBUG
54+
elif opts.quiet:
55+
log_level = logging.ERROR
56+
else:
57+
log_level = logging.INFO
5258
logging.basicConfig(format="{levelname} {message}", style='{', level=log_level)
5359
exe_path = paths.exe_file.relative_to(opts.swift_dir)
5460
for target in opts.generate:

0 commit comments

Comments
 (0)