Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing example to make CLI help more helpful for -x,--override #3119

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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