Skip to content

Commit

Permalink
Providing example to make CLI help more helpful for -x,--override (#3119
Browse files Browse the repository at this point in the history
)
  • Loading branch information
posita authored Sep 7, 2023
1 parent 9d07c06 commit 1b9c225
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/changelog/3119.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Provide example to make CLI help more helpful for -x,--override - by :user:`posita`. (:issue:`3119`)
2 changes: 1 addition & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ Set CLI flags via environment variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All CLI flags can be set via environment variables too, the naming convention here is ``TOX_<option>``. E.g.
``TOX_WORKDIR`` sets the ``--workdir`` flag, or ``TOX_OVERRIDE`` sets the ``--override`` flag. For flags accepting more
than one arguments (such as override) use the ``;`` character to separate these values:
than one argument, use the ``;`` character to separate these values:

.. code-block:: bash
Expand Down
4 changes: 2 additions & 2 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Here is a non-exhaustive list of these.
changed via ``TOX_CONFIG_FILE`` environment variable).
- All tox defaults can now be changed via an environment variable: ``TOX_`` prefix followed by the settings key,
e.g. ``TOX_PACKAGE=wheel``.
- Any configuration can be overwritten via the CLI ``-x`` or ``--override`` flag, e.g.
``tox run -e py311 -x testenv:py310.package=editable`` would force the packaging of environment ``py311`` to be an
- Any configuration can be overridden via the CLI ``-x`` or ``--override`` flag, e.g.
``tox run -e py311 -x testenv:py311.package=editable`` would force the packaging of environment ``py311`` to be an
editable install independent what's in the configuration file.
- :ref:`basepython` is now a list, the first successfully detected python will be used to generate python environment.
- We now have support for inline tox plugins via the ``toxfile.py`` at the root of your project. At a later time this
Expand Down
5 changes: 3 additions & 2 deletions src/tox/config/loader/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,15 @@ def build( # noqa: PLR0913

@impl
def tox_add_option(parser: ToxParser) -> None:
override_short_option = "-x"
parser.add_argument(
"-x",
override_short_option,
"--override",
action="append",
type=Override,
default=[],
dest="override",
help="configuration override(s)",
help=f"configuration override(s), e.g., {override_short_option} testenv:pypy3.ignore_errors=True",
)


Expand Down

0 comments on commit 1b9c225

Please sign in to comment.