diff --git a/osc/commandline.py b/osc/commandline.py index 321bd4e0..68374ea0 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -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, diff --git a/osc/conf.py b/osc/conf.py index 4cbfd9ea..0d914da7 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -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 diff --git a/tests/test_conf.py b/tests/test_conf.py index 3569632f..bfe1c327 100644 --- a/tests/test_conf.py +++ b/tests/test_conf.py @@ -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)