Repository: tox-dev/tox

Issue:
tox4: error: argument -q/--quiet: ignored explicit argument 're'
When I try to use the latest tox with merged command-line arguments like `tox4 -qre py310` it gives me the following error:
```
usage: tox4 [--colored {yes,no}] [-v | -q] [-c file] [--workdir dir] [--root dir]
tox4: error: argument -q/--quiet: ignored explicit argument 're'
```
Is that intentional?

Discussion:

Patch:
diff --git a/docs/changelog/2343.bugfix.rst b/docs/changelog/2343.bugfix.rst
new file mode 100644
index 00000000..8328e1a5
--- /dev/null
+++ b/docs/changelog/2343.bugfix.rst
@@ -0,0 +1,1 @@
+Fix CLI raises an error for ``-va`` with ``ignored explicit argument 'a'`` - by :user:`gaborbernat`.
diff --git a/src/tox/config/cli/parse.py b/src/tox/config/cli/parse.py
index 51e4c2de..e7868469 100644
--- a/src/tox/config/cli/parse.py
+++ b/src/tox/config/cli/parse.py
@@ -43,7 +43,11 @@ def get_options(*args: str) -> Options:
 def _get_base(args: Sequence[str]) -> tuple[int, ToxHandler, Source]:
     """First just load the base options (verbosity+color) to setup the logging framework."""
     tox_parser = ToxParser.base()
-    parsed, _ = tox_parser.parse_known_args(args)
+    parsed = Parsed()
+    try:
+        tox_parser.parse_known_args(args, namespace=parsed)
+    except SystemExit:
+        ...  # ignore parse errors, such as -va raises ignored explicit argument 'a'
     guess_verbosity = parsed.verbosity
     handler = setup_report(guess_verbosity, parsed.is_colored)
     from tox.plugin.manager import MANAGER  # load the plugin system right after we set up report


Test patch:
diff --git a/tests/config/cli/test_parse.py b/tests/config/cli/test_parse.py
index c635ac89..8852bfdb 100644
--- a/tests/config/cli/test_parse.py
+++ b/tests/config/cli/test_parse.py
@@ -38,3 +38,9 @@ def test_verbosity_guess_miss_match(capsys: CaptureFixture) -> None:
 
     out, err = capsys.readouterr()
     assert out == "ROOT: E\nROOT: W\nROOT: I\n"
+
+
+@pytest.mark.parametrize("arg", ["-av", "-va"])
+def test_verbosity(arg: str) -> None:
+    result = get_options(arg)
+    assert result.parsed.verbosity == 3