1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-03 21:36:15 +01:00

Implement 'quiet' conf option

This commit is contained in:
Daniel Mach 2024-01-24 09:49:22 +01:00
parent 237d0d30f6
commit a8c7661627
3 changed files with 21 additions and 2 deletions

View File

@ -344,13 +344,13 @@ class OscMainCommand(MainCommand):
"-v",
"--verbose",
action="store_true",
help="increase verbosity",
help="increase verbosity (conflicts with --quiet)",
)
self.add_argument(
"-q",
"--quiet",
action="store_true",
help="be quiet, not verbose",
help="be quiet, not verbose (conflicts with --verbose)",
)
self.add_argument(
"--debug",
@ -434,6 +434,7 @@ class OscMainCommand(MainCommand):
override_http_full_debug=args.http_full_debug,
override_no_keyring=args.no_keyring,
override_post_mortem=args.post_mortem,
override_quiet=args.quiet,
override_traceback=args.traceback,
override_verbose=args.verbose,
overrides=overrides,

View File

@ -559,6 +559,16 @@ class Options(OscOptions):
section=True,
) # type: ignore[assignment]
quiet: bool = Field(
default=False,
description=textwrap.dedent(
"""
Reduce amount of printed information to bare minimum.
Takes priority over ``verbose``.
"""
),
) # type: ignore[assignment]
verbose: bool = Field(
default=False,
description=textwrap.dedent(
@ -1782,6 +1792,7 @@ def get_config(override_conffile=None,
override_http_full_debug=None,
override_traceback=None,
override_post_mortem=None,
override_quiet=None,
override_no_keyring=None,
override_verbose=None,
overrides=None
@ -1822,6 +1833,9 @@ def get_config(override_conffile=None,
if override_no_keyring is not None:
overrides["use_keyring"] = not override_no_keyring
if override_quiet is not None:
overrides["quiet"] = override_quiet
if override_verbose is not None:
overrides["verbose"] = override_verbose

View File

@ -43,6 +43,7 @@ debug = 0
http_debug = 0
http_full_debug = 0
http_retries = 3
quiet = 0
verbose = 0
no_preinstallimage = 0
traceback = 0
@ -218,6 +219,9 @@ class TestExampleConfig(unittest.TestCase):
def test_http_retries(self):
self.assertEqual(self.config["http_retries"], 3)
def test_quiet(self):
self.assertEqual(self.config["quiet"], False)
def test_verbose(self):
self.assertEqual(self.config["verbose"], False)