Skip to content

Commit 1b9c225

Browse files
authored
Providing example to make CLI help more helpful for -x,--override (#3119)
1 parent 9d07c06 commit 1b9c225

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

docs/changelog/3119.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Provide example to make CLI help more helpful for -x,--override - by :user:`posita`. (:issue:`3119`)

docs/config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ Set CLI flags via environment variables
10451045
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10461046
All CLI flags can be set via environment variables too, the naming convention here is ``TOX_<option>``. E.g.
10471047
``TOX_WORKDIR`` sets the ``--workdir`` flag, or ``TOX_OVERRIDE`` sets the ``--override`` flag. For flags accepting more
1048-
than one arguments (such as override) use the ``;`` character to separate these values:
1048+
than one argument, use the ``;`` character to separate these values:
10491049

10501050
.. code-block:: bash
10511051

docs/faq.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Here is a non-exhaustive list of these.
5555
changed via ``TOX_CONFIG_FILE`` environment variable).
5656
- All tox defaults can now be changed via an environment variable: ``TOX_`` prefix followed by the settings key,
5757
e.g. ``TOX_PACKAGE=wheel``.
58-
- Any configuration can be overwritten via the CLI ``-x`` or ``--override`` flag, e.g.
59-
``tox run -e py311 -x testenv:py310.package=editable`` would force the packaging of environment ``py311`` to be an
58+
- Any configuration can be overridden via the CLI ``-x`` or ``--override`` flag, e.g.
59+
``tox run -e py311 -x testenv:py311.package=editable`` would force the packaging of environment ``py311`` to be an
6060
editable install independent what's in the configuration file.
6161
- :ref:`basepython` is now a list, the first successfully detected python will be used to generate python environment.
6262
- We now have support for inline tox plugins via the ``toxfile.py`` at the root of your project. At a later time this

src/tox/config/loader/api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,15 @@ def build( # noqa: PLR0913
177177

178178
@impl
179179
def tox_add_option(parser: ToxParser) -> None:
180+
override_short_option = "-x"
180181
parser.add_argument(
181-
"-x",
182+
override_short_option,
182183
"--override",
183184
action="append",
184185
type=Override,
185186
default=[],
186187
dest="override",
187-
help="configuration override(s)",
188+
help=f"configuration override(s), e.g., {override_short_option} testenv:pypy3.ignore_errors=True",
188189
)
189190

190191

0 commit comments

Comments
 (0)